summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Balbi <felipe.balbi@linux.intel.com>2016-05-23 10:53:34 (GMT)
committerFelipe Balbi <felipe.balbi@linux.intel.com>2016-06-20 09:32:40 (GMT)
commitf6bb225bb3ca7988ff373c62cc298e56cae1eee5 (patch)
tree0a349c83a4e98f1bda5d7c3eec20efd033867514
parentba1598410eff646e10be4e42d773e5bdc511d898 (diff)
downloadlinux-f6bb225bb3ca7988ff373c62cc298e56cae1eee5.tar.xz
usb: dwc3: gadget: loop while (timeout)
instead of having infinite loop and always checking timeout value as a break condition, we can just decrement timeout inside while's condition. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
-rw-r--r--drivers/usb/dwc3/gadget.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index e553a7c..25170fd 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -327,19 +327,13 @@ int dwc3_send_gadget_ep_cmd(struct dwc3_ep *dep, unsigned cmd,
break;
}
+ } while (--timeout);
- /*
- * We can't sleep here, because it is also called from
- * interrupt context.
- */
- timeout--;
- if (!timeout) {
- dwc3_trace(trace_dwc3_gadget,
- "Command Timed Out");
- ret = -ETIMEDOUT;
- break;
- }
- } while (1);
+ if (timeout == 0) {
+ dwc3_trace(trace_dwc3_gadget,
+ "Command Timed Out");
+ ret = -ETIMEDOUT;
+ }
if (unlikely(susphy)) {
reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));