aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/omap_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/omap_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/omap_udc.c')
-rw-r--r--drivers/usb/gadget/omap_udc.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index 030d87c28c2f..15d77c307930 100644
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -2043,7 +2043,6 @@ int usb_gadget_register_driver (struct usb_gadget_driver *driver)
2043 // FIXME if otg, check: driver->is_otg 2043 // FIXME if otg, check: driver->is_otg
2044 || driver->speed < USB_SPEED_FULL 2044 || driver->speed < USB_SPEED_FULL
2045 || !driver->bind 2045 || !driver->bind
2046 || !driver->unbind
2047 || !driver->setup) 2046 || !driver->setup)
2048 return -EINVAL; 2047 return -EINVAL;
2049 2048
@@ -2087,9 +2086,11 @@ int usb_gadget_register_driver (struct usb_gadget_driver *driver)
2087 status = otg_set_peripheral(udc->transceiver, &udc->gadget); 2086 status = otg_set_peripheral(udc->transceiver, &udc->gadget);
2088 if (status < 0) { 2087 if (status < 0) {
2089 ERR("can't bind to transceiver\n"); 2088 ERR("can't bind to transceiver\n");
2090 driver->unbind (&udc->gadget); 2089 if (driver->unbind) {
2091 udc->gadget.dev.driver = NULL; 2090 driver->unbind (&udc->gadget);
2092 udc->driver = NULL; 2091 udc->gadget.dev.driver = NULL;
2092 udc->driver = NULL;
2093 }
2093 goto done; 2094 goto done;
2094 } 2095 }
2095 } else { 2096 } else {
@@ -2117,7 +2118,7 @@ int usb_gadget_unregister_driver (struct usb_gadget_driver *driver)
2117 2118
2118 if (!udc) 2119 if (!udc)
2119 return -ENODEV; 2120 return -ENODEV;
2120 if (!driver || driver != udc->driver) 2121 if (!driver || driver != udc->driver || !driver->unbind)
2121 return -EINVAL; 2122 return -EINVAL;
2122 2123
2123 if (machine_is_omap_innovator() || machine_is_omap_osk()) 2124 if (machine_is_omap_innovator() || machine_is_omap_osk())
@@ -2870,6 +2871,8 @@ static int __exit omap_udc_remove(struct platform_device *pdev)
2870 2871
2871 if (!udc) 2872 if (!udc)
2872 return -ENODEV; 2873 return -ENODEV;
2874 if (udc->driver)
2875 return -EBUSY;
2873 2876
2874 udc->done = &done; 2877 udc->done = &done;
2875 2878