USB: s3c2410: deactivate endpoints before gadget unbinding
authorVladimir Zapolskiy <vzapolskiy@gmail.com>
Fri, 18 Jun 2010 04:25:00 +0000 (08:25 +0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 30 Jun 2010 15:16:06 +0000 (08:16 -0700)
Gadget disconnect must be called before unbinding to avoid races.
The change fixes an oops on g_ether module unregistering.

Signed-off-by: Vladimir Zapolskiy <vzapolskiy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/gadget/s3c2410_udc.c

index d5f4c1d45c9703add01e29e582e5f705e87cc83f..e724a051bfdd11bcd520ae90ff0b0c448883d13f 100644 (file)
@@ -1700,9 +1700,13 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
        if (!driver || driver != udc->driver || !driver->unbind)
                return -EINVAL;
 
-       dprintk(DEBUG_NORMAL,"usb_gadget_register_driver() '%s'\n",
+       dprintk(DEBUG_NORMAL, "usb_gadget_unregister_driver() '%s'\n",
                driver->driver.name);
 
+       /* report disconnect */
+       if (driver->disconnect)
+               driver->disconnect(&udc->gadget);
+
        driver->unbind(&udc->gadget);
 
        device_del(&udc->gadget.dev);