usb: pd: Avoid double queue of usbpd_sm work
PD state transitions call kick_sm which can either queue the
workqueue immediately or with some delay. Both phy_msg_received()
and psy_changed() also call this when receiving a message or
Type-C event. But there is a possibility that usbpd_sm is already
executing due to a previous state transition and hence an extra
queue_work() is called from these events. If the next transition
has a deliberate delay such as waiting for SENDER_RESPONSE_TIME,
the delay is effectively eliminated and usbpd_sm gets executed
immediately again which can cause the state machine to think that
timeout occurred and will result in soft or hard reset. Avoid this
by adding a work_busy check for usbpd_sm work so that is is not
queued twice without any delay.
Change-Id: I9d5f478e8e0abe5609c80979b3158db16373dc52
Signed-off-by:
Pratham Pratap <prathampratap@codeaurora.org>
Loading
Please register or sign in to comment