diff mbox series

[4/6] thunderbolt: Retry USB4 block read operation

Message ID 20200616135617.85752-5-mika.westerberg@linux.intel.com (mailing list archive)
State Mainlined
Commit 6bfe33473eaac9443dfce129b3107cc27abc1e47
Headers show
Series thunderbolt: Add retimer NVM upgrade support | expand

Commit Message

Mika Westerberg June 16, 2020, 1:56 p.m. UTC
Especially when accessing retimers over USB4 sideband operations the
possibility to get read errors seems to be higher so make the
usb4_do_read_data() retry a couple of times if it sees any other error
than -ENODEV (device is gone). We can only do this for read side because
it carries the offset as part of metadata (as opposed to writes).

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
 drivers/thunderbolt/usb4.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/drivers/thunderbolt/usb4.c b/drivers/thunderbolt/usb4.c
index 8a83857573df..142c7244bdb1 100644
--- a/drivers/thunderbolt/usb4.c
+++ b/drivers/thunderbolt/usb4.c
@@ -115,11 +115,8 @@  static int usb4_do_read_data(u16 address, void *buf, size_t size,
 
 		ret = read_block(read_block_data, dwaddress, data, dwords);
 		if (ret) {
-			if (ret == -ETIMEDOUT) {
-				if (retries--)
-					continue;
-				ret = -EIO;
-			}
+			if (ret != -ENODEV && retries--)
+				continue;
 			return ret;
 		}