From bb0147364850c42db2a0dff5ef018e57413eaf79 Mon Sep 17 00:00:00 2001 From: Baolin Wang Date: Fri, 14 Oct 2016 17:11:33 +0800 Subject: usb: dwc3: gadget: don't clear RUN/STOP when it's invalid to do so When we change the USB function with configfs dynamically, we possibly met this situation: one core is doing the control transfer, another core is trying to unregister the USB gadget from userspace, we must wait for completing this control tranfer, or it will hang the controller to set the DEVCTRLHLT flag. [ felipe.balbi@linux.intel.com: several fixes to the patch - call complete() before starting following SETUP transfer - add a macro for ep0_in_setup's timeout - change commit subject slightly - break lines at 72 characters (git adds an 8-character tab) - avoid changes to dwc3_gadget_run_stop() ] Signed-off-by: Baolin Wang Signed-off-by: Felipe Balbi --- drivers/usb/dwc3/ep0.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/usb/dwc3/ep0.c') diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c index a1f7c2b4b000..15b62a5aaff8 100644 --- a/drivers/usb/dwc3/ep0.c +++ b/drivers/usb/dwc3/ep0.c @@ -284,6 +284,8 @@ void dwc3_ep0_out_start(struct dwc3 *dwc) { int ret; + complete(&dwc->ep0_in_setup); + ret = dwc3_ep0_start_trans(dwc, 0, dwc->ctrl_req_addr, 8, DWC3_TRBCTL_CONTROL_SETUP, false); WARN_ON(ret < 0); -- cgit v1.2.3