]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
usb: gadget: udc-core: fix incompatibility with dummy-hcd
authorAlan Stern <stern@rowland.harvard.edu>
Thu, 26 Apr 2012 15:31:57 +0000 (11:31 -0400)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 11 May 2012 12:14:04 +0000 (13:14 +0100)
commit 320cd1e750f1bf3e47eb41209dcb2be07264cb76 upstream.

This patch (as1548) fixes a recently-introduced incompatibility
between the UDC core and the dummy-hcd driver.  Commit
8ae8090c82eb407267001f75b3d256b3bd4ae691 (usb: gadget: udc-core: fix
asymmetric calls in remove_driver) moved the usb_gadget_udc_stop()
call in usb_gadget_remove_driver() below the usb_gadget_disconnect()
call.

As a result, usb_gadget_disconnect() gets called at a time when the
gadget driver believes it has been unbound but dummy-hcd believes
it has not.  A nasty error ensues when dummy-hcd calls the gadget
driver's disconnect method a second time.

To fix the problem, this patch moves the gadget driver's unbind
notification after the usb_gadget_disconnect() call.  Now nothing
happens between the two unbind notifications, so nothing goes wrong.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Tested-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/usb/gadget/udc-core.c

index d81fb2540a088afa1386548f994dbb4247793380..901924a12d07739db737035aca520f921627972c 100644 (file)
@@ -211,8 +211,8 @@ static void usb_gadget_remove_driver(struct usb_udc *udc)
 
        if (udc_is_newstyle(udc)) {
                udc->driver->disconnect(udc->gadget);
-               udc->driver->unbind(udc->gadget);
                usb_gadget_disconnect(udc->gadget);
+               udc->driver->unbind(udc->gadget);
                usb_gadget_udc_stop(udc->gadget, udc->driver);
        } else {
                usb_gadget_stop(udc->gadget, udc->driver);