wlcore: don't set SDIO_FAILED flag when driver state is off
authorArik Nemtsov <arik@wizery.com>
Tue, 3 Jul 2012 06:00:18 +0000 (09:00 +0300)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 10 Jul 2012 16:10:14 +0000 (12:10 -0400)
If some IO read/write fails while the FW is not loaded, a recovery
will not take place. This means the SDIO_FAILED flag will stay in place
forever and prevent further read/writes.

This can happen if a check for STATE_OFF was forgotten in some routine.

Take this opportunity to rename the flag to IO_FAILED, since we support
other buses as well.

Reported-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
drivers/net/wireless/ti/wlcore/io.h
drivers/net/wireless/ti/wlcore/wlcore_i.h

index 458da55845334adb41a50253c1b5b8e3ac7b6b45..259149f36faec0b7108500302f30e66e323cc1aa 100644 (file)
@@ -60,12 +60,12 @@ static inline int __must_check wlcore_raw_write(struct wl1271 *wl, int addr,
 {
        int ret;
 
-       if (test_bit(WL1271_FLAG_SDIO_FAILED, &wl->flags))
+       if (test_bit(WL1271_FLAG_IO_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);
+       if (ret && wl->state != WL1271_STATE_OFF)
+               set_bit(WL1271_FLAG_IO_FAILED, &wl->flags);
 
        return ret;
 }
@@ -76,12 +76,12 @@ static inline int __must_check wlcore_raw_read(struct wl1271 *wl, int addr,
 {
        int ret;
 
-       if (test_bit(WL1271_FLAG_SDIO_FAILED, &wl->flags))
+       if (test_bit(WL1271_FLAG_IO_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);
+       if (ret && wl->state != WL1271_STATE_OFF)
+               set_bit(WL1271_FLAG_IO_FAILED, &wl->flags);
 
        return ret;
 }
index a760407cb1782ff3bb6fddcef941ba9c948ce3b5..2a0e896b7d0cd59209a861c3fcf7d571ec3ab960 100644 (file)
@@ -238,7 +238,7 @@ enum wl12xx_flags {
        WL1271_FLAG_RECOVERY_IN_PROGRESS,
        WL1271_FLAG_VIF_CHANGE_IN_PROGRESS,
        WL1271_FLAG_INTENDED_FW_RECOVERY,
-       WL1271_FLAG_SDIO_FAILED,
+       WL1271_FLAG_IO_FAILED,
 };
 
 enum wl12xx_vif_flags {