aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/goku_udc.c
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2006-12-05 06:15:33 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-12-20 13:14:26 -0500
commit6bea476cf628eb7bb18a036ac6a8fed1ad319951 (patch)
tree1d73df1432d393ecf82c16604fa40f0f8a1aa581 /drivers/usb/gadget/goku_udc.c
parent5f8364b7d63acdc2216ca0f7d0a8557c318479ea (diff)
USB: gadget driver unbind() is optional; section fixes; misc
Allow gadget drivers to omit the unbind() method. When they're statically linked, that's an appropriate memory saving tweak. Similarly, provide consistent/simpler handling for a should-not-happen error case: removing a peripheral controller driver when a gadget driver is still loaded. Such code dates back to early versions of the first implementation of the gadget API, and has never been triggered. Includes relevant section annotation fixs for gmidi.c, file_storage.c, and serial.c; we don't yet have an "init or exit" annotation. Also some whitespace fixes in gmidi.c (space at EOL, before tabs, etc). Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget/goku_udc.c')
-rw-r--r--drivers/usb/gadget/goku_udc.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/usb/gadget/goku_udc.c b/drivers/usb/gadget/goku_udc.c
index 805a9826842d..d0ef1d6b3fac 100644
--- a/drivers/usb/gadget/goku_udc.c
+++ b/drivers/usb/gadget/goku_udc.c
@@ -1432,7 +1432,6 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
1432 if (!driver 1432 if (!driver
1433 || driver->speed != USB_SPEED_FULL 1433 || driver->speed != USB_SPEED_FULL
1434 || !driver->bind 1434 || !driver->bind
1435 || !driver->unbind
1436 || !driver->disconnect 1435 || !driver->disconnect
1437 || !driver->setup) 1436 || !driver->setup)
1438 return -EINVAL; 1437 return -EINVAL;
@@ -1495,7 +1494,7 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
1495 1494
1496 if (!dev) 1495 if (!dev)
1497 return -ENODEV; 1496 return -ENODEV;
1498 if (!driver || driver != dev->driver) 1497 if (!driver || driver != dev->driver || !driver->unbind)
1499 return -EINVAL; 1498 return -EINVAL;
1500 1499
1501 spin_lock_irqsave(&dev->lock, flags); 1500 spin_lock_irqsave(&dev->lock, flags);
@@ -1808,13 +1807,8 @@ static void goku_remove(struct pci_dev *pdev)
1808 struct goku_udc *dev = pci_get_drvdata(pdev); 1807 struct goku_udc *dev = pci_get_drvdata(pdev);
1809 1808
1810 DBG(dev, "%s\n", __FUNCTION__); 1809 DBG(dev, "%s\n", __FUNCTION__);
1811 /* start with the driver above us */ 1810
1812 if (dev->driver) { 1811 BUG_ON(dev->driver);
1813 /* should have been done already by driver model core */
1814 WARN(dev, "pci remove, driver '%s' is still registered\n",
1815 dev->driver->driver.name);
1816 usb_gadget_unregister_driver(dev->driver);
1817 }
1818 1812
1819#ifdef CONFIG_USB_GADGET_DEBUG_FILES 1813#ifdef CONFIG_USB_GADGET_DEBUG_FILES
1820 remove_proc_entry(proc_node_name, NULL); 1814 remove_proc_entry(proc_node_name, NULL);