summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/goku_udc.c
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2006-12-05 12:15:33 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2006-12-20 19:14:26 +0100
commit6bea476cf628eb7bb18a036ac6a8fed1ad319951 (patch)
tree1d73df1432d393ecf82c16604fa40f0f8a1aa581 /drivers/usb/gadget/goku_udc.c
parentUHCI: module parameter to ignore overcurrent changes (diff)
downloadlinux-6bea476cf628eb7bb18a036ac6a8fed1ad319951.tar.xz
linux-6bea476cf628eb7bb18a036ac6a8fed1ad319951.zip
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)
if (!driver
|| driver->speed != USB_SPEED_FULL
|| !driver->bind
- || !driver->unbind
|| !driver->disconnect
|| !driver->setup)
return -EINVAL;
@@ -1495,7 +1494,7 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
if (!dev)
return -ENODEV;
- if (!driver || driver != dev->driver)
+ if (!driver || driver != dev->driver || !driver->unbind)
return -EINVAL;
spin_lock_irqsave(&dev->lock, flags);
@@ -1808,13 +1807,8 @@ static void goku_remove(struct pci_dev *pdev)
struct goku_udc *dev = pci_get_drvdata(pdev);
DBG(dev, "%s\n", __FUNCTION__);
- /* start with the driver above us */
- if (dev->driver) {
- /* should have been done already by driver model core */
- WARN(dev, "pci remove, driver '%s' is still registered\n",
- dev->driver->driver.name);
- usb_gadget_unregister_driver(dev->driver);
- }
+
+ BUG_ON(dev->driver);
#ifdef CONFIG_USB_GADGET_DEBUG_FILES
remove_proc_entry(proc_node_name, NULL);