By simply setting a flag, we can drop some
boilerplate code.

Signed-off-by: Felipe Balbi <ba...@ti.com>
---
 drivers/usb/gadget/pxa25x_udc.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c
index 9aa9dd5..99557387 100644
--- a/drivers/usb/gadget/pxa25x_udc.c
+++ b/drivers/usb/gadget/pxa25x_udc.c
@@ -2134,16 +2134,9 @@ static int __init pxa25x_udc_probe(struct 
platform_device *pdev)
        dev->timer.function = udc_watchdog;
        dev->timer.data = (unsigned long) dev;
 
-       device_initialize(&dev->gadget.dev);
        dev->gadget.dev.parent = &pdev->dev;
        dev->gadget.dev.dma_mask = pdev->dev.dma_mask;
-
-       retval = device_add(&dev->gadget.dev);
-       if (retval) {
-               dev->driver = NULL;
-               dev->gadget.dev.driver = NULL;
-               goto err_device_add;
-       }
+       dev->gadget.register_my_device = true;
 
        the_controller = dev;
        platform_set_drvdata(pdev, dev);
@@ -2195,8 +2188,6 @@ lubbock_fail0:
        free_irq(irq, dev);
 #endif
  err_irq1:
-       device_unregister(&dev->gadget.dev);
- err_device_add:
        if (gpio_is_valid(dev->mach->gpio_pullup))
                gpio_free(dev->mach->gpio_pullup);
  err_gpio_pullup:
@@ -2222,7 +2213,6 @@ static int __exit pxa25x_udc_remove(struct 
platform_device *pdev)
                return -EBUSY;
 
        usb_del_gadget_udc(&dev->gadget);
-       device_unregister(&dev->gadget.dev);
        dev->pullup = 0;
        pullup(dev);
 
-- 
1.8.1.rc1.5.g7e0651a

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to