Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 564b4172 authored by Jack Pham's avatar Jack Pham
Browse files

usb: pd: Rerun usbpd_sm if RX queue is not empty



Upon receiving a PD message the state machine is queued to
act on it. However, if another message is received quickly
before usbpd_sm is scheduled, it will only process the first
message. Add a check if the RX queue is not empty in order
to drain the messages properly.

Change-Id: Ie9e079a51a5740024c9a1be5ba27b3edacf9b2df
Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
parent 684a7b03
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -2313,6 +2313,14 @@ static void usbpd_sm(struct work_struct *w)
sm_done:
sm_done:
	kfree(rx_msg);
	kfree(rx_msg);


	spin_lock_irqsave(&pd->rx_lock, flags);
	ret = list_empty(&pd->rx_q);
	spin_unlock_irqrestore(&pd->rx_lock, flags);

	/* requeue if there are any new/pending RX messages */
	if (!ret)
		kick_sm(pd, 0);

	if (!pd->sm_queued)
	if (!pd->sm_queued)
		pm_relax(&pd->dev);
		pm_relax(&pd->dev);
}
}