diff options
author | Amitkumar Karwar <akarwar@marvell.com> | 2009-09-30 20:04:38 -0700 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-10-07 16:39:43 -0400 |
commit | 4912545472d71e3dd546b18b397aec4c89fd7403 (patch) | |
tree | b7b0d520cdbee35303caf69881f7898e38966bc7 /drivers/net/wireless/libertas/debugfs.c | |
parent | 125b181aec7a67c71234284ecf6d9c729d05deda (diff) |
libertas: Add auto deep sleep support for SD8385/SD8686/SD8688
Add timer based auto deep sleep feature in libertas driver which can be
configured using iwconfig command. This is tested on SD8688, SD8686 cards
with firmware versions 10.38.1.p25, 9.70.4.p0 respectively on 32-bit and 64-bit
platforms. Tests have been done for USB/CS cards to make sure that the patch
won't break USB/CS code. We didn't test the if_spi driver.
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/debugfs.c')
-rw-r--r-- | drivers/net/wireless/libertas/debugfs.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c index 893a55ca344..8a7e9319c9e 100644 --- a/drivers/net/wireless/libertas/debugfs.c +++ b/drivers/net/wireless/libertas/debugfs.c @@ -117,6 +117,11 @@ static ssize_t lbs_sleepparams_write(struct file *file, if (!buf) return -ENOMEM; + if (!lbs_is_cmd_allowed(priv)) { + ret = -EBUSY; + goto out_unlock; + } + buf_size = min(count, len - 1); if (copy_from_user(buf, user_buf, buf_size)) { ret = -EFAULT; @@ -157,6 +162,11 @@ static ssize_t lbs_sleepparams_read(struct file *file, char __user *userbuf, if (!buf) return -ENOMEM; + if (!lbs_is_cmd_allowed(priv)) { + ret = -EBUSY; + goto out_unlock; + } + ret = lbs_cmd_802_11_sleep_params(priv, CMD_ACT_GET, &sp); if (ret) goto out_unlock; @@ -223,6 +233,9 @@ static ssize_t lbs_threshold_read(uint16_t tlv_type, uint16_t event_mask, u8 freq; int events = 0; + if (!lbs_is_cmd_allowed(priv)) + return -EBUSY; + buf = (char *)get_zeroed_page(GFP_KERNEL); if (!buf) return -ENOMEM; @@ -275,6 +288,9 @@ static ssize_t lbs_threshold_write(uint16_t tlv_type, uint16_t event_mask, char *buf; int ret; + if (!lbs_is_cmd_allowed(priv)) + return -EBUSY; + buf = (char *)get_zeroed_page(GFP_KERNEL); if (!buf) return -ENOMEM; @@ -444,6 +460,11 @@ static ssize_t lbs_rdmac_read(struct file *file, char __user *userbuf, if (!buf) return -ENOMEM; + if (!lbs_is_cmd_allowed(priv)) { + free_page(addr); + return -EBUSY; + } + offval.offset = priv->mac_offset; offval.value = 0; @@ -496,6 +517,11 @@ static ssize_t lbs_wrmac_write(struct file *file, if (!buf) return -ENOMEM; + if (!lbs_is_cmd_allowed(priv)) { + res = -EBUSY; + goto out_unlock; + } + buf_size = min(count, len - 1); if (copy_from_user(buf, userbuf, buf_size)) { res = -EFAULT; @@ -532,6 +558,11 @@ static ssize_t lbs_rdbbp_read(struct file *file, char __user *userbuf, if (!buf) return -ENOMEM; + if (!lbs_is_cmd_allowed(priv)) { + free_page(addr); + return -EBUSY; + } + offval.offset = priv->bbp_offset; offval.value = 0; @@ -585,6 +616,11 @@ static ssize_t lbs_wrbbp_write(struct file *file, if (!buf) return -ENOMEM; + if (!lbs_is_cmd_allowed(priv)) { + res = -EBUSY; + goto out_unlock; + } + buf_size = min(count, len - 1); if (copy_from_user(buf, userbuf, buf_size)) { res = -EFAULT; @@ -621,6 +657,11 @@ static ssize_t lbs_rdrf_read(struct file *file, char __user *userbuf, if (!buf) return -ENOMEM; + if (!lbs_is_cmd_allowed(priv)) { + free_page(addr); + return -EBUSY; + } + offval.offset = priv->rf_offset; offval.value = 0; @@ -674,6 +715,11 @@ static ssize_t lbs_wrrf_write(struct file *file, if (!buf) return -ENOMEM; + if (!lbs_is_cmd_allowed(priv)) { + res = -EBUSY; + goto out_unlock; + } + buf_size = min(count, len - 1); if (copy_from_user(buf, userbuf, buf_size)) { res = -EFAULT; |