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

Commit dbc1ac4a authored by Bar Weiner's avatar Bar Weiner
Browse files

usb: dwc3: gadget: Release spinlock to allow timeout



Since spinlock is locked, jiffies does not update
during the loop iterations. If the break condition
is never met, we get stuck in an infinite loop.
Releasing the spinlock solves this issue.

Change-Id: I420c825ce006d976e819793eb569013de87cfc40
Signed-off-by: default avatarBar Weiner <bweiner@codeaurora.org>
parent 9aa23df6
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1571,6 +1571,7 @@ static int dwc3_gadget_wakeup(struct usb_gadget *g)
	/* poll until Link State changes to ON */
	timeout = jiffies + msecs_to_jiffies(100);

	spin_unlock_irqrestore(&dwc->lock, flags);
	while (!time_after(jiffies, timeout)) {
		reg = dwc3_readl(dwc->regs, DWC3_DSTS);

@@ -1578,6 +1579,7 @@ static int dwc3_gadget_wakeup(struct usb_gadget *g)
		if (DWC3_DSTS_USBLNKST(reg) == DWC3_LINK_STATE_U0)
			break;
	}
	spin_lock_irqsave(&dwc->lock, flags);

	if (DWC3_DSTS_USBLNKST(reg) != DWC3_LINK_STATE_U0) {
		dev_err(dwc->dev, "failed to send remote wakeup\n");