aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/net2280.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/net2280.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/net2280.c')
-rw-r--r--drivers/usb/gadget/net2280.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c
index 3024c679e38e..569eb8ccf232 100644
--- a/drivers/usb/gadget/net2280.c
+++ b/drivers/usb/gadget/net2280.c
@@ -2020,7 +2020,6 @@ int usb_gadget_register_driver (struct usb_gadget_driver *driver)
2020 if (!driver 2020 if (!driver
2021 || driver->speed != USB_SPEED_HIGH 2021 || driver->speed != USB_SPEED_HIGH
2022 || !driver->bind 2022 || !driver->bind
2023 || !driver->unbind
2024 || !driver->setup) 2023 || !driver->setup)
2025 return -EINVAL; 2024 return -EINVAL;
2026 if (!dev) 2025 if (!dev)
@@ -2107,7 +2106,7 @@ int usb_gadget_unregister_driver (struct usb_gadget_driver *driver)
2107 2106
2108 if (!dev) 2107 if (!dev)
2109 return -ENODEV; 2108 return -ENODEV;
2110 if (!driver || driver != dev->driver) 2109 if (!driver || driver != dev->driver || !driver->unbind)
2111 return -EINVAL; 2110 return -EINVAL;
2112 2111
2113 spin_lock_irqsave (&dev->lock, flags); 2112 spin_lock_irqsave (&dev->lock, flags);
@@ -2803,13 +2802,7 @@ static void net2280_remove (struct pci_dev *pdev)
2803{ 2802{
2804 struct net2280 *dev = pci_get_drvdata (pdev); 2803 struct net2280 *dev = pci_get_drvdata (pdev);
2805 2804
2806 /* start with the driver above us */ 2805 BUG_ON(dev->driver);
2807 if (dev->driver) {
2808 /* should have been done already by driver model core */
2809 WARN (dev, "pci remove, driver '%s' is still registered\n",
2810 dev->driver->driver.name);
2811 usb_gadget_unregister_driver (dev->driver);
2812 }
2813 2806
2814 /* then clean up the resources we allocated during probe() */ 2807 /* then clean up the resources we allocated during probe() */
2815 net2280_led_shutdown (dev); 2808 net2280_led_shutdown (dev);