summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/ti/wl18xx/io.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-06-30 03:28:28 +0400
committerDavid S. Miller <davem@davemloft.net>2012-06-30 03:28:28 +0400
commitdd7f36ba3ce17d4fe85987d83efd5901b0935816 (patch)
treebad385290c22f6e10c2f587af4b9df0dfeb99e8b /drivers/net/wireless/ti/wl18xx/io.c
parentae0eef66088777cf252c6b91d3eb5ef2f30a67c5 (diff)
parent8732baafc3f19e69df683c3f0f36c13cec746fb9 (diff)
downloadlinux-dd7f36ba3ce17d4fe85987d83efd5901b0935816.tar.xz
Merge branch 'for-davem' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next
John Linville says: ==================== Here is another batch of updates intended for 3.6. This includes a number of pulls, including ones from the mac80211, iwlwifi, ath6kl, and wl12xx trees. I also pulled from the wireless tree to avoid potential build conflicts. There are a number of other patches applied directly, including a number for the Broadcom drivers and the mwifiex driver. The updates cover the usual variety of new hardware support and feature enhancements. It's all good work, but there aren't any big headliners. This does resolve a net-next/wireless-next merge conflict reported by Stephen. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wireless/ti/wl18xx/io.c')
-rw-r--r--drivers/net/wireless/ti/wl18xx/io.c39
1 files changed, 27 insertions, 12 deletions
diff --git a/drivers/net/wireless/ti/wl18xx/io.c b/drivers/net/wireless/ti/wl18xx/io.c
index 598c057e722b..0c06ccfd1b8c 100644
--- a/drivers/net/wireless/ti/wl18xx/io.c
+++ b/drivers/net/wireless/ti/wl18xx/io.c
@@ -24,37 +24,52 @@
#include "io.h"
-void wl18xx_top_reg_write(struct wl1271 *wl, int addr, u16 val)
+int wl18xx_top_reg_write(struct wl1271 *wl, int addr, u16 val)
{
u32 tmp;
+ int ret;
if (WARN_ON(addr % 2))
- return;
+ return -EINVAL;
if ((addr % 4) == 0) {
- tmp = wl1271_read32(wl, addr);
+ ret = wlcore_read32(wl, addr, &tmp);
+ if (ret < 0)
+ goto out;
+
tmp = (tmp & 0xffff0000) | val;
- wl1271_write32(wl, addr, tmp);
+ ret = wlcore_write32(wl, addr, tmp);
} else {
- tmp = wl1271_read32(wl, addr - 2);
+ ret = wlcore_read32(wl, addr - 2, &tmp);
+ if (ret < 0)
+ goto out;
+
tmp = (tmp & 0xffff) | (val << 16);
- wl1271_write32(wl, addr - 2, tmp);
+ ret = wlcore_write32(wl, addr - 2, tmp);
}
+
+out:
+ return ret;
}
-u16 wl18xx_top_reg_read(struct wl1271 *wl, int addr)
+int wl18xx_top_reg_read(struct wl1271 *wl, int addr, u16 *out)
{
u32 val;
+ int ret;
if (WARN_ON(addr % 2))
- return 0;
+ return -EINVAL;
if ((addr % 4) == 0) {
/* address is 4-bytes aligned */
- val = wl1271_read32(wl, addr);
- return val & 0xffff;
+ ret = wlcore_read32(wl, addr, &val);
+ if (ret >= 0 && out)
+ *out = val & 0xffff;
} else {
- val = wl1271_read32(wl, addr - 2);
- return (val & 0xffff0000) >> 16;
+ ret = wlcore_read32(wl, addr - 2, &val);
+ if (ret >= 0 && out)
+ *out = (val & 0xffff0000) >> 16;
}
+
+ return ret;
}