thunderbolt: Retry USB4 block read operation
authorMika Westerberg <mika.westerberg@linux.intel.com>
Fri, 14 Feb 2020 17:25:34 +0000 (19:25 +0200)
committerMika Westerberg <mika.westerberg@linux.intel.com>
Mon, 22 Jun 2020 16:58:32 +0000 (19:58 +0300)
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

index 8a83857573df19c89a37a91669bac5003f7548f7..142c7244bdb12fa5f6ddd876ea2a82450288c481 100644 (file)
@@ -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;
                }