Skip to content

Commit

Permalink
wlcore: don't allow SDIO read/writes after failure
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Arik Nemtsov authored and Luciano Coelho committed Jun 23, 2012
1 parent 96caded commit 1d23396
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
22 changes: 20 additions & 2 deletions drivers/net/wireless/ti/wlcore/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/ti/wlcore/wlcore_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ enum wl12xx_flags {
WL1271_FLAG_RECOVERY_IN_PROGRESS,
WL1271_FLAG_VIF_CHANGE_IN_PROGRESS,
WL1271_FLAG_INTENDED_FW_RECOVERY,
WL1271_FLAG_SDIO_FAILED,
};

enum wl12xx_vif_flags {
Expand Down

0 comments on commit 1d23396

Please sign in to comment.