Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1d23396d authored by Arik Nemtsov's avatar Arik Nemtsov Committed by Luciano Coelho
Browse files

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: default avatarArik Nemtsov <arik@wizery.com>
Signed-off-by: default avatarLuciano Coelho <coelho@ti.com>
parent 96caded8
Loading
Loading
Loading
Loading
+20 −2
Original line number Diff line number Diff line
@@ -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,
+1 −0
Original line number Diff line number Diff line
@@ -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 {