Google
  Web www.spinics.net

Re: [patch 2.6.24-rc3] usb peripheral controller driver oops avoidance

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


From: Patrik Sevallius <patrik.sevallius@xxxxxxxx>

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@xxxxxxxx>
[ Same bug was in other peripheral controller drivers; fixed ]
Signed-off-by: David Brownell <dbrownell@xxxxxxxxxxxxxxxxxxxxx>
---
Updated version:  dummy_hcd not changed

 drivers/usb/gadget/amd5536udc.c  |    1 +
 drivers/usb/gadget/at91_udc.c    |    2 ++
 drivers/usb/gadget/goku_udc.c    |    1 +
 drivers/usb/gadget/lh7a40x_udc.c |    1 +
 drivers/usb/gadget/m66592-udc.c  |    1 +
 drivers/usb/gadget/pxa2xx_udc.c  |    1 +
 6 files changed, 7 insertions(+)

--- at91.orig/drivers/usb/gadget/amd5536udc.c	2007-11-19 12:33:33.000000000 -0800
+++ at91/drivers/usb/gadget/amd5536udc.c	2007-11-19 12:38:31.000000000 -0800
@@ -2038,6 +2038,7 @@ int usb_gadget_unregister_driver(struct 
 	spin_unlock_irqrestore(&dev->lock, flags);
 
 	driver->unbind(&dev->gadget);
+	dev->gadget.dev.driver = NULL;
 	dev->driver = NULL;
 
 	/* set SD */
--- at91.orig/drivers/usb/gadget/at91_udc.c	2007-11-19 12:20:20.000000000 -0800
+++ at91/drivers/usb/gadget/at91_udc.c	2007-11-19 12:20:21.000000000 -0800
@@ -1614,6 +1614,8 @@ int usb_gadget_unregister_driver (struct
 	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);
--- at91.orig/drivers/usb/gadget/goku_udc.c	2007-11-19 12:33:34.000000000 -0800
+++ at91/drivers/usb/gadget/goku_udc.c	2007-11-19 12:36:29.000000000 -0800
@@ -1422,6 +1422,7 @@ int usb_gadget_unregister_driver(struct 
 	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;
--- at91.orig/drivers/usb/gadget/lh7a40x_udc.c	2007-11-19 12:33:34.000000000 -0800
+++ at91/drivers/usb/gadget/lh7a40x_udc.c	2007-11-19 12:36:56.000000000 -0800
@@ -474,6 +474,7 @@ int usb_gadget_unregister_driver(struct 
 	spin_unlock_irqrestore(&dev->lock, flags);
 
 	driver->unbind(&dev->gadget);
+	dev->gadget.dev.driver = NULL;
 	device_del(&dev->gadget.dev);
 
 	udc_disable(dev);
--- at91.orig/drivers/usb/gadget/m66592-udc.c	2007-11-19 12:33:34.000000000 -0800
+++ at91/drivers/usb/gadget/m66592-udc.c	2007-11-19 12:42:47.000000000 -0800
@@ -1456,6 +1456,7 @@ int usb_gadget_unregister_driver(struct 
 	m66592_bclr(m66592, M66592_VBSE | M66592_URST, M66592_INTENB0);
 
 	driver->unbind(&m66592->gadget);
+	m66592->gadget.dev.driver = NULL;
 
 	init_controller(m66592);
 	disable_controller(m66592);
--- at91.orig/drivers/usb/gadget/pxa2xx_udc.c	2007-11-19 12:33:34.000000000 -0800
+++ at91/drivers/usb/gadget/pxa2xx_udc.c	2007-11-19 12:37:46.000000000 -0800
@@ -1345,6 +1345,7 @@ int usb_gadget_unregister_driver(struct 
 	local_irq_enable();
 
 	driver->unbind(&dev->gadget);
+	dev->gadget.dev.driver = NULL;
 	dev->driver = NULL;
 
 	device_del (&dev->gadget.dev);

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
linux-usb-devel@xxxxxxxxxxxxxxxxxxxxx
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

[Home]     [Video for Linux]     [Photo]     [Yosemite Forum]     [Yosemite Photos]    [Video Projectors]     [PDAs]     [Hacking TiVo]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Devices]     [Big List of Linux Books]     [Free Dating]

  Powered by Linux