Commit 0b3702c6 authored by Felipe Balbi's avatar Felipe Balbi

usb: gadget: imx_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 5637bf5b
...@@ -1461,15 +1461,10 @@ static int __init imx_udc_probe(struct platform_device *pdev) ...@@ -1461,15 +1461,10 @@ static int __init imx_udc_probe(struct platform_device *pdev)
imx_usb->clk = clk; imx_usb->clk = clk;
imx_usb->dev = &pdev->dev; imx_usb->dev = &pdev->dev;
device_initialize(&imx_usb->gadget.dev); imx_usb->gadget.register_my_device = true;
imx_usb->gadget.dev.parent = &pdev->dev; imx_usb->gadget.dev.parent = &pdev->dev;
imx_usb->gadget.dev.dma_mask = pdev->dev.dma_mask; imx_usb->gadget.dev.dma_mask = pdev->dev.dma_mask;
ret = device_add(&imx_usb->gadget.dev);
if (retval)
goto fail4;
platform_set_drvdata(pdev, imx_usb); platform_set_drvdata(pdev, imx_usb);
usb_init_data(imx_usb); usb_init_data(imx_usb);
...@@ -1481,11 +1476,9 @@ static int __init imx_udc_probe(struct platform_device *pdev) ...@@ -1481,11 +1476,9 @@ static int __init imx_udc_probe(struct platform_device *pdev)
ret = usb_add_gadget_udc(&pdev->dev, &imx_usb->gadget); ret = usb_add_gadget_udc(&pdev->dev, &imx_usb->gadget);
if (ret) if (ret)
goto fail5; goto fail4;
return 0; return 0;
fail5:
device_unregister(&imx_usb->gadget.dev);
fail4: fail4:
for (i = 0; i < IMX_USB_NB_EP + 1; i++) for (i = 0; i < IMX_USB_NB_EP + 1; i++)
free_irq(imx_usb->usbd_int[i], imx_usb); free_irq(imx_usb->usbd_int[i], imx_usb);
...@@ -1509,7 +1502,6 @@ static int __exit imx_udc_remove(struct platform_device *pdev) ...@@ -1509,7 +1502,6 @@ static int __exit imx_udc_remove(struct platform_device *pdev)
int i; int i;
usb_del_gadget_udc(&imx_usb->gadget); usb_del_gadget_udc(&imx_usb->gadget);
device_unregister(&imx_usb->gadget.dev);
imx_udc_disable(imx_usb); imx_udc_disable(imx_usb);
del_timer(&imx_usb->timer); del_timer(&imx_usb->timer);
......
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