Commit 621c723e authored by Felipe Balbi's avatar Felipe Balbi

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

By simply setting a flag, we can drop some
boilerplate code.
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 2533beea
...@@ -1900,9 +1900,9 @@ static int __init usba_udc_probe(struct platform_device *pdev) ...@@ -1900,9 +1900,9 @@ static int __init usba_udc_probe(struct platform_device *pdev)
dev_info(&pdev->dev, "FIFO at 0x%08lx mapped at %p\n", dev_info(&pdev->dev, "FIFO at 0x%08lx mapped at %p\n",
(unsigned long)fifo->start, udc->fifo); (unsigned long)fifo->start, udc->fifo);
device_initialize(&udc->gadget.dev);
udc->gadget.dev.parent = &pdev->dev; udc->gadget.dev.parent = &pdev->dev;
udc->gadget.dev.dma_mask = pdev->dev.dma_mask; udc->gadget.dev.dma_mask = pdev->dev.dma_mask;
udc->gadget.register_my_device = true;
platform_set_drvdata(pdev, udc); platform_set_drvdata(pdev, udc);
...@@ -1962,12 +1962,6 @@ static int __init usba_udc_probe(struct platform_device *pdev) ...@@ -1962,12 +1962,6 @@ static int __init usba_udc_probe(struct platform_device *pdev)
} }
udc->irq = irq; udc->irq = irq;
ret = device_add(&udc->gadget.dev);
if (ret) {
dev_dbg(&pdev->dev, "Could not add gadget: %d\n", ret);
goto err_device_add;
}
if (gpio_is_valid(pdata->vbus_pin)) { if (gpio_is_valid(pdata->vbus_pin)) {
if (!gpio_request(pdata->vbus_pin, "atmel_usba_udc")) { if (!gpio_request(pdata->vbus_pin, "atmel_usba_udc")) {
udc->vbus_pin = pdata->vbus_pin; udc->vbus_pin = pdata->vbus_pin;
...@@ -2007,9 +2001,6 @@ static int __init usba_udc_probe(struct platform_device *pdev) ...@@ -2007,9 +2001,6 @@ static int __init usba_udc_probe(struct platform_device *pdev)
gpio_free(udc->vbus_pin); gpio_free(udc->vbus_pin);
} }
device_unregister(&udc->gadget.dev);
err_device_add:
free_irq(irq, udc); free_irq(irq, udc);
err_request_irq: err_request_irq:
kfree(usba_ep); kfree(usba_ep);
...@@ -2053,8 +2044,6 @@ static int __exit usba_udc_remove(struct platform_device *pdev) ...@@ -2053,8 +2044,6 @@ static int __exit usba_udc_remove(struct platform_device *pdev)
clk_put(udc->hclk); clk_put(udc->hclk);
clk_put(udc->pclk); clk_put(udc->pclk);
device_unregister(&udc->gadget.dev);
return 0; return 0;
} }
......
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