[PATCH 3/6] usb: dwc3: shorten long delay in dwc3_gadget_set_link_state()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The loop in dwc3_gadget_set_link_state() was using a udelay(500),
which is a long time to delay in interrupt context. Change it to
udelay(5) and increase the loop count to match.

Signed-off-by: Paul Zimmerman <paulz@xxxxxxxxxxxx>
---
 drivers/usb/dwc3/gadget.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index b2672e0..5a36f52 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -93,11 +93,11 @@ int dwc3_gadget_set_test_mode(struct dwc3 *dwc, int mode)
  * @state: the state to put link into
  *
  * Caller should take care of locking. This function will
- * return 0 on success or -EINVAL.
+ * return 0 on success or -ETIMEDOUT.
  */
 int dwc3_gadget_set_link_state(struct dwc3 *dwc, enum dwc3_link_state state)
 {
-	int		retries = 100;
+	int		retries = 10000;
 	u32		reg;
 
 	reg = dwc3_readl(dwc->regs, DWC3_DCTL);
@@ -111,11 +111,10 @@ int dwc3_gadget_set_link_state(struct dwc3 *dwc, enum dwc3_link_state state)
 	while (--retries) {
 		reg = dwc3_readl(dwc->regs, DWC3_DSTS);
 
-		/* in HS, means ON */
 		if (DWC3_DSTS_USBLNKST(reg) == state)
 			return 0;
 
-		udelay(500);
+		udelay(5);
 	}
 
 	dev_vdbg(dwc->dev, "link state change request timed out\n");
-- 
1.7.4.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux