Commit 2533beea authored by Felipe Balbi's avatar Felipe Balbi

usb: gadget: at91_udc: let udc-core manage gadget->dev

By simply setting a flag, we can remove some
boilerplate code.
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 12ad0fca
...@@ -1726,6 +1726,7 @@ static int at91udc_probe(struct platform_device *pdev) ...@@ -1726,6 +1726,7 @@ static int at91udc_probe(struct platform_device *pdev)
/* init software state */ /* init software state */
udc = &controller; udc = &controller;
udc->gadget.register_my_device = true;
udc->gadget.dev.parent = dev; udc->gadget.dev.parent = dev;
if (pdev->dev.of_node) if (pdev->dev.of_node)
at91udc_of_init(udc, pdev->dev.of_node); at91udc_of_init(udc, pdev->dev.of_node);
...@@ -1780,13 +1781,7 @@ static int at91udc_probe(struct platform_device *pdev) ...@@ -1780,13 +1781,7 @@ static int at91udc_probe(struct platform_device *pdev)
DBG("clocks missing\n"); DBG("clocks missing\n");
retval = -ENODEV; retval = -ENODEV;
/* NOTE: we "know" here that refcounts on these are NOPs */ /* NOTE: we "know" here that refcounts on these are NOPs */
goto fail0b; goto fail1;
}
retval = device_register(&udc->gadget.dev);
if (retval < 0) {
put_device(&udc->gadget.dev);
goto fail0b;
} }
/* don't do anything until we have both gadget driver and VBUS */ /* don't do anything until we have both gadget driver and VBUS */
...@@ -1857,8 +1852,6 @@ static int at91udc_probe(struct platform_device *pdev) ...@@ -1857,8 +1852,6 @@ static int at91udc_probe(struct platform_device *pdev)
fail2: fail2:
free_irq(udc->udp_irq, udc); free_irq(udc->udp_irq, udc);
fail1: fail1:
device_unregister(&udc->gadget.dev);
fail0b:
iounmap(udc->udp_baseaddr); iounmap(udc->udp_baseaddr);
fail0a: fail0a:
if (cpu_is_at91rm9200()) if (cpu_is_at91rm9200())
...@@ -1892,8 +1885,6 @@ static int __exit at91udc_remove(struct platform_device *pdev) ...@@ -1892,8 +1885,6 @@ static int __exit at91udc_remove(struct platform_device *pdev)
gpio_free(udc->board.vbus_pin); gpio_free(udc->board.vbus_pin);
} }
free_irq(udc->udp_irq, udc); free_irq(udc->udp_irq, udc);
device_unregister(&udc->gadget.dev);
iounmap(udc->udp_baseaddr); iounmap(udc->udp_baseaddr);
if (cpu_is_at91rm9200()) if (cpu_is_at91rm9200())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment