aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/at91_udc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/gadget/at91_udc.c')
-rw-r--r--drivers/usb/gadget/at91_udc.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
index 3e0abbb49fe1..81656337381f 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -1574,7 +1574,6 @@ int usb_gadget_register_driver (struct usb_gadget_driver *driver)
1574 if (!driver 1574 if (!driver
1575 || driver->speed != USB_SPEED_FULL 1575 || driver->speed != USB_SPEED_FULL
1576 || !driver->bind 1576 || !driver->bind
1577 || !driver->unbind
1578 || !driver->setup) { 1577 || !driver->setup) {
1579 DBG("bad parameter.\n"); 1578 DBG("bad parameter.\n");
1580 return -EINVAL; 1579 return -EINVAL;
@@ -1611,7 +1610,7 @@ int usb_gadget_unregister_driver (struct usb_gadget_driver *driver)
1611{ 1610{
1612 struct at91_udc *udc = &controller; 1611 struct at91_udc *udc = &controller;
1613 1612
1614 if (!driver || driver != udc->driver) 1613 if (!driver || driver != udc->driver || !driver->unbind)
1615 return -EINVAL; 1614 return -EINVAL;
1616 1615
1617 local_irq_disable(); 1616 local_irq_disable();
@@ -1731,10 +1730,10 @@ static int __devexit at91udc_remove(struct platform_device *pdev)
1731 1730
1732 DBG("remove\n"); 1731 DBG("remove\n");
1733 1732
1734 pullup(udc, 0); 1733 if (udc->driver)
1734 return -EBUSY;
1735 1735
1736 if (udc->driver != 0) 1736 pullup(udc, 0);
1737 usb_gadget_unregister_driver(udc->driver);
1738 1737
1739 device_init_wakeup(&pdev->dev, 0); 1738 device_init_wakeup(&pdev->dev, 0);
1740 remove_debug_file(udc); 1739 remove_debug_file(udc);