diff options
author | Mian Yousaf Kaukab <yousaf.kaukab@intel.com> | 2015-09-29 13:08:25 +0300 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2015-10-01 20:40:26 +0300 |
commit | 5390d438e6f4aaf3555acc72aff155660a48cd28 (patch) | |
tree | 87ac6d976987dc637bce73b3f3968d7207b7039d /drivers/usb/dwc2/gadget.c | |
parent | c524dd5f432a0690710b62e729a3673c557d8b58 (diff) | |
download | linux-5390d438e6f4aaf3555acc72aff155660a48cd28.tar.xz |
usb: dwc2: gadget: kill ep0 requests before reinitializing core
Make sure there are no requests pending on ep0 before reinitializing
core. Otherwise, dwc2_hsotg_enqueue_setup will fail afterwards.
Also, take hsotg->lock before calling
dwc2_hsotg_core_init_disconnected() from dwc2_conn_id_status_change()
as dwc2_hsotg_complete_request() expect lock to be held.
Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com>
Tested-by: Robert Baldyga <r.baldyga@samsung.com>
Tested-by: Dinh Nguyen <dinguyen@opensource.altera.com>
Tested-by: John Youn <johnyoun@synopsys.com>
Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc2/gadget.c')
-rw-r--r-- | drivers/usb/dwc2/gadget.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 38c29a8bdd11..2d81fc5f39e9 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -2287,6 +2287,9 @@ void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg, { u32 val; + /* Kill any ep0 requests as controller will be reinitialized */ + kill_all_requests(hsotg, hsotg->eps_out[0], -ECONNRESET); + if (!is_usb_reset) if (dwc2_hsotg_corereset(hsotg)) return; @@ -2515,9 +2518,6 @@ irq_retry: if (time_after(jiffies, hsotg->last_rst + msecs_to_jiffies(200))) { - kill_all_requests(hsotg, hsotg->eps_out[0], - -ECONNRESET); - dwc2_hsotg_core_init_disconnected(hsotg, true); } } @@ -3296,8 +3296,6 @@ static int dwc2_hsotg_vbus_session(struct usb_gadget *gadget, int is_active) if (hsotg->lx_state == DWC2_L2) dwc2_exit_hibernation(hsotg, false); - /* Kill any ep0 requests as controller will be reinitialized */ - kill_all_requests(hsotg, hsotg->eps_out[0], -ECONNRESET); dwc2_hsotg_core_init_disconnected(hsotg, false); if (hsotg->enabled) dwc2_hsotg_core_connect(hsotg); |