usb: gadget: core: fix bug when removing gadget drivers
authorFelipe Balbi <balbi@ti.com>
Mon, 3 Oct 2011 13:39:30 +0000 (16:39 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 14 Nov 2011 19:51:16 +0000 (11:51 -0800)
usb_gadget_disconnect() is responsible of removing
data pullups. Before doing that we must, first, tell
gadget driver we're disconnecting (by calling disconnect
method on gadget driver structure), unbind the gadget
driver and stop the controller.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/gadget/udc-core.c

index 31e410bbe55a3677fcc5449417f044c684253e2a..4c5ff14a7c612ea00713bea64445780bc33b97fb 100644 (file)
@@ -210,10 +210,10 @@ static void usb_gadget_remove_driver(struct usb_udc *udc)
        kobject_uevent(&udc->dev.kobj, KOBJ_CHANGE);
 
        if (udc_is_newstyle(udc)) {
-               usb_gadget_disconnect(udc->gadget);
+               udc->driver->disconnect(udc->gadget);
                udc->driver->unbind(udc->gadget);
                usb_gadget_udc_stop(udc->gadget, udc->driver);
-
+               usb_gadget_disconnect(udc->gadget);
        } else {
                usb_gadget_stop(udc->gadget, udc->driver);
        }