usb: dwc3: gadget: release spin lock during gadget resume
authorJiebing Li <jiebing.li@intel.com>
Thu, 11 Dec 2014 05:26:29 +0000 (13:26 +0800)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Tue, 29 Mar 2016 06:30:31 +0000 (09:30 +0300)
It's a requirement that we release controller's lock
while calling gadget API function pointers. This
patch just fixes that long standing bug.

Signed-off-by: Jiebing Li <jiebing.li@intel.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/dwc3/gadget.c

index 3ac170f9d94d46156a172231c61be29c8067af09..3d2c53e4ac9223d89690f42ce0ee6f7d3c858ec1 100644 (file)
@@ -2487,7 +2487,11 @@ static void dwc3_gadget_wakeup_interrupt(struct dwc3 *dwc)
         * implemented.
         */
 
-       dwc->gadget_driver->resume(&dwc->gadget);
+       if (dwc->gadget_driver && dwc->gadget_driver->resume) {
+               spin_unlock(&dwc->lock);
+               dwc->gadget_driver->resume(&dwc->gadget);
+               spin_lock(&dwc->lock);
+       }
 }
 
 static void dwc3_gadget_linksts_change_interrupt(struct dwc3 *dwc,