summaryrefslogtreecommitdiff
path: root/drivers/thunderbolt
diff options
context:
space:
mode:
authorMika Westerberg <mika.westerberg@linux.intel.com>2022-02-13 18:16:24 +0300
committerMika Westerberg <mika.westerberg@linux.intel.com>2022-05-05 09:25:16 +0300
commit0a2e1667a73fe0c4374ddace925d85a4072d509c (patch)
tree76c2f1696905bd4f44378909712fdf8e17a8a73a /drivers/thunderbolt
parent0e14dd5e14d697e2489c7bf0fe35947831de3975 (diff)
downloadlinux-0a2e1667a73fe0c4374ddace925d85a4072d509c.tar.xz
thunderbolt: Ignore port locked error in tb_port_wait_for_link_width()
Sometimes when polling for the port after target link width is changed we get back port locked notification (because the link actually was reset and then re-trained). Instead of bailing out we can ignore these when polling for the width change as this is expected. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to 'drivers/thunderbolt')
-rw-r--r--drivers/thunderbolt/switch.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c
index 525be2aa3ad9..561e1d77240e 100644
--- a/drivers/thunderbolt/switch.c
+++ b/drivers/thunderbolt/switch.c
@@ -1168,10 +1168,17 @@ int tb_port_wait_for_link_width(struct tb_port *port, int width,
do {
ret = tb_port_get_link_width(port);
- if (ret < 0)
- return ret;
- else if (ret == width)
+ if (ret < 0) {
+ /*
+ * Sometimes we get port locked error when
+ * polling the lanes so we can ignore it and
+ * retry.
+ */
+ if (ret != -EACCES)
+ return ret;
+ } else if (ret == width) {
return 0;
+ }
usleep_range(1000, 2000);
} while (ktime_before(ktime_get(), timeout));