diff options
Diffstat (limited to 'drivers/usb/gadget/omap_udc.c')
-rw-r--r-- | drivers/usb/gadget/omap_udc.c | 13 |
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 | ||