summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/ti/wlcore/io.h
diff options
context:
space:
mode:
authorArik Nemtsov <arik@wizery.com>2012-06-21 15:10:48 (GMT)
committerLuciano Coelho <coelho@ti.com>2012-06-23 06:28:54 (GMT)
commit1d23396d9df0a9543b2ba5c288f4914ad1f19e46 (patch)
treecf797bb7a56a8f79e65e4503d4f739b4c8e748c1 /drivers/net/wireless/ti/wlcore/io.h
parent96caded8d275f67c6000fa219b0c11e7d6bf8e0b (diff)
downloadlinux-1d23396d9df0a9543b2ba5c288f4914ad1f19e46.tar.xz
wlcore: don't allow SDIO read/writes after failure
Set a flag and after the first read/write failure is encountered. This flag will disallow further SDIO read/writes until op_stop() is executed, which will clear all flags. This prevents further errors from occurring, since one error usually indicates that IO operations won't work anymore until the chip is rebooted. By blocking more calls, we avoid extra timeouts and having to wait for them to occur. [Added second paragraph explaining why the change is needed. -- Luca] Signed-off-by: Arik Nemtsov <arik@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
Diffstat (limited to 'drivers/net/wireless/ti/wlcore/io.h')
-rw-r--r--drivers/net/wireless/ti/wlcore/io.h22
1 files changed, 20 insertions, 2 deletions
diff --git a/drivers/net/wireless/ti/wlcore/io.h b/drivers/net/wireless/ti/wlcore/io.h
index 1cd545b..fef80ad 100644
--- a/drivers/net/wireless/ti/wlcore/io.h
+++ b/drivers/net/wireless/ti/wlcore/io.h
@@ -57,14 +57,32 @@ static inline int __must_check wlcore_raw_write(struct wl1271 *wl, int addr,
void *buf, size_t len,
bool fixed)
{
- return wl->if_ops->write(wl->dev, addr, buf, len, fixed);
+ int ret;
+
+ if (test_bit(WL1271_FLAG_SDIO_FAILED, &wl->flags))
+ return -EIO;
+
+ ret = wl->if_ops->write(wl->dev, addr, buf, len, fixed);
+ if (ret)
+ set_bit(WL1271_FLAG_SDIO_FAILED, &wl->flags);
+
+ return ret;
}
static inline int __must_check wlcore_raw_read(struct wl1271 *wl, int addr,
void *buf, size_t len,
bool fixed)
{
- return wl->if_ops->read(wl->dev, addr, buf, len, fixed);
+ int ret;
+
+ if (test_bit(WL1271_FLAG_SDIO_FAILED, &wl->flags))
+ return -EIO;
+
+ ret = wl->if_ops->read(wl->dev, addr, buf, len, fixed);
+ if (ret)
+ set_bit(WL1271_FLAG_SDIO_FAILED, &wl->flags);
+
+ return ret;
}
static inline int __must_check wlcore_raw_read_data(struct wl1271 *wl, int reg,