[PATCH v3 1/2] usb: typec: tcpm: Don't cut a pending state delay short on a re-queue
From: Arun Iyengar via B4 Relay
Date: Thu Nov 26 2026 - 04:19:43 EST
From: Arun Iyengar <aiyengar1990@xxxxxxxxx>
A re-queue while the work runs applies a pending delayed state at once
(the 100 ms ErrorRecovery took 6 us). Re-arm the timer for the time left.
Fixes: 3ed8e1c2ac99 ("usb: typec: tcpm: Migrate workqueue to RT priority for processing events")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Arun Iyengar <aiyengar1990@xxxxxxxxx>
---
drivers/usb/typec/tcpm/tcpm.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index 51e5c72799f2..565073b4ca93 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -6572,6 +6572,11 @@ static void tcpm_state_machine_work(struct kthread_work *work)
/* If we were queued due to a delayed state change, update it now */
if (port->delayed_state) {
+ if (ktime_after(port->delayed_runtime, ktime_get())) {
+ hrtimer_start(&port->state_machine_timer,
+ port->delayed_runtime, HRTIMER_MODE_ABS);
+ goto done;
+ }
tcpm_log(port, "state change %s -> %s [delayed %ld ms]",
tcpm_states[port->state],
tcpm_states[port->delayed_state], port->delay_ms);
--
2.55.0