usb: dwc3: gadget: don't clear RUN/STOP when it's invalid to do so
authorBaolin Wang <baolin.wang@linaro.org>
Fri, 14 Oct 2016 09:11:33 +0000 (17:11 +0800)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Thu, 3 Nov 2016 08:38:35 +0000 (10:38 +0200)
commitbb0147364850c42db2a0dff5ef018e57413eaf79
tree64a3f60eb0aa3883832ffbf72f86d46c71521a5a
parentcf68923055cbb3a2d6a819a7197e4f69bf68cc44
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 <baolin.wang@linaro.org>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/dwc3/core.h
drivers/usb/dwc3/ep0.c
drivers/usb/dwc3/gadget.c