Commit 4455556d authored by Arik Nemtsov's avatar Arik Nemtsov Committed by John W. Linville
Browse files

wlcore: don't set SDIO_FAILED flag when driver state is off



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: default avatarIdo Yariv <ido@wizery.com>
Signed-off-by: default avatarArik Nemtsov <arik@wizery.com>
parent c45ee4ff
Loading
Loading
Loading
Loading
+6 −6
Original line number Original line Diff line number Diff line
@@ -60,12 +60,12 @@ static inline int __must_check wlcore_raw_write(struct wl1271 *wl, int addr,
{
{
	int ret;
	int ret;


	if (test_bit(WL1271_FLAG_SDIO_FAILED, &wl->flags))
	if (test_bit(WL1271_FLAG_IO_FAILED, &wl->flags))
		return -EIO;
		return -EIO;


	ret = wl->if_ops->write(wl->dev, addr, buf, len, fixed);
	ret = wl->if_ops->write(wl->dev, addr, buf, len, fixed);
	if (ret)
	if (ret && wl->state != WL1271_STATE_OFF)
		set_bit(WL1271_FLAG_SDIO_FAILED, &wl->flags);
		set_bit(WL1271_FLAG_IO_FAILED, &wl->flags);


	return ret;
	return ret;
}
}
@@ -76,12 +76,12 @@ static inline int __must_check wlcore_raw_read(struct wl1271 *wl, int addr,
{
{
	int ret;
	int ret;


	if (test_bit(WL1271_FLAG_SDIO_FAILED, &wl->flags))
	if (test_bit(WL1271_FLAG_IO_FAILED, &wl->flags))
		return -EIO;
		return -EIO;


	ret = wl->if_ops->read(wl->dev, addr, buf, len, fixed);
	ret = wl->if_ops->read(wl->dev, addr, buf, len, fixed);
	if (ret)
	if (ret && wl->state != WL1271_STATE_OFF)
		set_bit(WL1271_FLAG_SDIO_FAILED, &wl->flags);
		set_bit(WL1271_FLAG_IO_FAILED, &wl->flags);


	return ret;
	return ret;
}
}
+1 −1
Original line number Original line Diff line number Diff line
@@ -238,7 +238,7 @@ enum wl12xx_flags {
	WL1271_FLAG_RECOVERY_IN_PROGRESS,
	WL1271_FLAG_RECOVERY_IN_PROGRESS,
	WL1271_FLAG_VIF_CHANGE_IN_PROGRESS,
	WL1271_FLAG_VIF_CHANGE_IN_PROGRESS,
	WL1271_FLAG_INTENDED_FW_RECOVERY,
	WL1271_FLAG_INTENDED_FW_RECOVERY,
	WL1271_FLAG_SDIO_FAILED,
	WL1271_FLAG_IO_FAILED,
};
};


enum wl12xx_vif_flags {
enum wl12xx_vif_flags {