diff options
author | Pratyush Anand <pratyush.anand@st.com> | 2012-07-02 00:51:55 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2012-07-02 03:04:02 -0400 |
commit | 6f17f74b3d8345663f5fcfd834145685110075bd (patch) | |
tree | 6c9ded5a65bc3d6a2c4930f677863273d3cb976e | |
parent | e274a31e29b6a097c32f526493f4ebce10856dcb (diff) |
usb: dwc3: return error in case of run/stop timeout
Although timeout has never been experienced, still to make it
meaningful, its better to return error if it ever occurs.
Signed-off-by: Pratyush Anand <pratyush.anand@st.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r-- | drivers/usb/dwc3/gadget.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 39626e366a82..aedc1c5cfac1 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
@@ -1408,7 +1408,7 @@ static int dwc3_gadget_set_selfpowered(struct usb_gadget *g, | |||
1408 | return 0; | 1408 | return 0; |
1409 | } | 1409 | } |
1410 | 1410 | ||
1411 | static void dwc3_gadget_run_stop(struct dwc3 *dwc, int is_on) | 1411 | static int dwc3_gadget_run_stop(struct dwc3 *dwc, int is_on) |
1412 | { | 1412 | { |
1413 | u32 reg; | 1413 | u32 reg; |
1414 | u32 timeout = 500; | 1414 | u32 timeout = 500; |
@@ -1440,7 +1440,7 @@ static void dwc3_gadget_run_stop(struct dwc3 *dwc, int is_on) | |||
1440 | } | 1440 | } |
1441 | timeout--; | 1441 | timeout--; |
1442 | if (!timeout) | 1442 | if (!timeout) |
1443 | break; | 1443 | return -ETIMEDOUT; |
1444 | udelay(1); | 1444 | udelay(1); |
1445 | } while (1); | 1445 | } while (1); |
1446 | 1446 | ||
@@ -1448,20 +1448,23 @@ static void dwc3_gadget_run_stop(struct dwc3 *dwc, int is_on) | |||
1448 | dwc->gadget_driver | 1448 | dwc->gadget_driver |
1449 | ? dwc->gadget_driver->function : "no-function", | 1449 | ? dwc->gadget_driver->function : "no-function", |
1450 | is_on ? "connect" : "disconnect"); | 1450 | is_on ? "connect" : "disconnect"); |
1451 | |||
1452 | return 0; | ||
1451 | } | 1453 | } |
1452 | 1454 | ||
1453 | static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on) | 1455 | static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on) |
1454 | { | 1456 | { |
1455 | struct dwc3 *dwc = gadget_to_dwc(g); | 1457 | struct dwc3 *dwc = gadget_to_dwc(g); |
1456 | unsigned long flags; | 1458 | unsigned long flags; |
1459 | int ret; | ||
1457 | 1460 | ||
1458 | is_on = !!is_on; | 1461 | is_on = !!is_on; |
1459 | 1462 | ||
1460 | spin_lock_irqsave(&dwc->lock, flags); | 1463 | spin_lock_irqsave(&dwc->lock, flags); |
1461 | dwc3_gadget_run_stop(dwc, is_on); | 1464 | ret = dwc3_gadget_run_stop(dwc, is_on); |
1462 | spin_unlock_irqrestore(&dwc->lock, flags); | 1465 | spin_unlock_irqrestore(&dwc->lock, flags); |
1463 | 1466 | ||
1464 | return 0; | 1467 | return ret; |
1465 | } | 1468 | } |
1466 | 1469 | ||
1467 | static int dwc3_gadget_start(struct usb_gadget *g, | 1470 | static int dwc3_gadget_start(struct usb_gadget *g, |