Skip to content

Commit d7b070e

Browse files
committed
thunderbolt: Increase timeout of DP OUT adapter handshake
jira LE-1907 Rebuild_History Non-Buildable kernel-5.14.0-284.30.1.el9_2 commit-author Mika Westerberg <mika.westerberg@linux.intel.com> commit fe1a1cf Sometimes the current timeout is not enough so increase it to 1500 ms and while there make the loop use ktime instead. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> (cherry picked from commit fe1a1cf) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent 7f6e36e commit d7b070e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

drivers/thunderbolt/tunnel.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,10 @@ static bool tb_dp_is_usb4(const struct tb_switch *sw)
339339
return tb_switch_is_usb4(sw) || tb_switch_is_titan_ridge(sw);
340340
}
341341

342-
static int tb_dp_cm_handshake(struct tb_port *in, struct tb_port *out)
342+
static int tb_dp_cm_handshake(struct tb_port *in, struct tb_port *out,
343+
int timeout_msec)
343344
{
344-
int timeout = 10;
345+
ktime_t timeout = ktime_add_ms(ktime_get(), timeout_msec);
345346
u32 val;
346347
int ret;
347348

@@ -368,8 +369,8 @@ static int tb_dp_cm_handshake(struct tb_port *in, struct tb_port *out)
368369
return ret;
369370
if (!(val & DP_STATUS_CTRL_CMHS))
370371
return 0;
371-
usleep_range(10, 100);
372-
} while (timeout--);
372+
usleep_range(100, 150);
373+
} while (ktime_before(ktime_get(), timeout));
373374

374375
return -ETIMEDOUT;
375376
}
@@ -519,7 +520,7 @@ static int tb_dp_xchg_caps(struct tb_tunnel *tunnel)
519520
* Perform connection manager handshake between IN and OUT ports
520521
* before capabilities exchange can take place.
521522
*/
522-
ret = tb_dp_cm_handshake(in, out);
523+
ret = tb_dp_cm_handshake(in, out, 1500);
523524
if (ret)
524525
return ret;
525526

0 commit comments

Comments
 (0)