]> git.karo-electronics.de Git - linux-beck.git/commitdiff
USB: usb peripheral controller driver oops avoidance
authorPatrik Sevallius <patrik.sevallius@enea.com>
Tue, 20 Nov 2007 17:32:00 +0000 (09:32 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 1 Feb 2008 22:34:52 +0000 (14:34 -0800)
I'm having problem with oopses when rebooting, if I modprobe g_serial
and rmmod g_serial and do a reboot I get an oops in device_shutdown().
The reason seems to be that usb_gadget_unregister_driver() doesn't do
enough cleanup.  With this at91_udc patch I don't get the oops.

Signed-off-by: Patrik Sevallius <patrik.sevallius@enea.com>
[ Same bug was in other peripheral controller drivers; fixed ]
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/gadget/amd5536udc.c
drivers/usb/gadget/at91_udc.c
drivers/usb/gadget/goku_udc.c
drivers/usb/gadget/lh7a40x_udc.c
drivers/usb/gadget/m66592-udc.c
drivers/usb/gadget/pxa2xx_udc.c

index 66e10da8a490406581dd856dd7016643f1f9e588..b663f23f2642ab5a157039e98c1f92b678927ee1 100644 (file)
@@ -2038,6 +2038,7 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
        spin_unlock_irqrestore(&dev->lock, flags);
 
        driver->unbind(&dev->gadget);
+       dev->gadget.dev.driver = NULL;
        dev->driver = NULL;
 
        /* set SD */
index cd62b029d1766e606945e2c8a12e1ecc08fd119f..4b6ed353ae36c7c5511e8ece5bde0a214c47fe59 100644 (file)
@@ -1616,6 +1616,8 @@ int usb_gadget_unregister_driver (struct usb_gadget_driver *driver)
        local_irq_enable();
 
        driver->unbind(&udc->gadget);
+       udc->gadget.dev.driver = NULL;
+       udc->gadget.dev.driver_data = NULL;
        udc->driver = NULL;
 
        DBG("unbound from %s\n", driver->driver.name);
index 2ec9d196a8cfdc798232d2d51f1d4aad6686338f..d3e702576de6e23c7aca952bc40cc3288de1dd59 100644 (file)
@@ -1422,6 +1422,7 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
        spin_unlock_irqrestore(&dev->lock, flags);
 
        driver->unbind(&dev->gadget);
+       dev->gadget.dev.driver = NULL;
 
        DBG(dev, "unregistered driver '%s'\n", driver->driver.name);
        return 0;
index 367b75c0b25b3e8f9a4af753fa9c6cea8578d097..37243ef7104ef7d0f24ff1369c99cf33fcb947c6 100644 (file)
@@ -474,6 +474,7 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
        spin_unlock_irqrestore(&dev->lock, flags);
 
        driver->unbind(&dev->gadget);
+       dev->gadget.dev.driver = NULL;
        device_del(&dev->gadget.dev);
 
        udc_disable(dev);
index 43f02189dc44dd74f4292a40db20ab19946a43da..835948f0715a9118f18e90a83fb2e2ff28161895 100644 (file)
@@ -1508,6 +1508,7 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
        m66592_bclr(m66592, M66592_VBSE | M66592_URST, M66592_INTENB0);
 
        driver->unbind(&m66592->gadget);
+       m66592->gadget.dev.driver = NULL;
 
        init_controller(m66592);
        disable_controller(m66592);
index 8c139d416ac4b3ac29b4a2005cd09cc1871840e2..4abf9d26d6150f71bd8051ec08671e412899ee39 100644 (file)
@@ -1345,6 +1345,7 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
        local_irq_enable();
 
        driver->unbind(&dev->gadget);
+       dev->gadget.dev.driver = NULL;
        dev->driver = NULL;
 
        device_del (&dev->gadget.dev);