Commit 6dfc84fc authored by Felipe Balbi's avatar Felipe Balbi

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

By simply setting a flag, we drop some boilerplate
code.
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 5ed01c64
...@@ -2632,10 +2632,9 @@ omap_udc_setup(struct platform_device *odev, struct usb_phy *xceiv) ...@@ -2632,10 +2632,9 @@ omap_udc_setup(struct platform_device *odev, struct usb_phy *xceiv)
udc->gadget.max_speed = USB_SPEED_FULL; udc->gadget.max_speed = USB_SPEED_FULL;
udc->gadget.name = driver_name; udc->gadget.name = driver_name;
device_initialize(&udc->gadget.dev);
dev_set_name(&udc->gadget.dev, "gadget");
udc->gadget.dev.release = omap_udc_release; udc->gadget.dev.release = omap_udc_release;
udc->gadget.dev.parent = &odev->dev; udc->gadget.dev.parent = &odev->dev;
udc->gadget.register_my_device = true;
if (use_dma) if (use_dma)
udc->gadget.dev.dma_mask = odev->dev.dma_mask; udc->gadget.dev.dma_mask = odev->dev.dma_mask;
...@@ -2912,14 +2911,12 @@ static int omap_udc_probe(struct platform_device *pdev) ...@@ -2912,14 +2911,12 @@ static int omap_udc_probe(struct platform_device *pdev)
} }
create_proc_file(); create_proc_file();
status = device_add(&udc->gadget.dev); status = usb_add_gadget_udc(&pdev->dev, &udc->gadget);
if (status) if (status)
goto cleanup4; goto cleanup4;
status = usb_add_gadget_udc(&pdev->dev, &udc->gadget); return 0;
if (!status)
return status;
/* If fail, fall through */
cleanup4: cleanup4:
remove_proc_file(); remove_proc_file();
...@@ -2990,7 +2987,6 @@ static int omap_udc_remove(struct platform_device *pdev) ...@@ -2990,7 +2987,6 @@ static int omap_udc_remove(struct platform_device *pdev)
release_mem_region(pdev->resource[0].start, release_mem_region(pdev->resource[0].start,
pdev->resource[0].end - pdev->resource[0].start + 1); pdev->resource[0].end - pdev->resource[0].start + 1);
device_unregister(&udc->gadget.dev);
wait_for_completion(&done); wait_for_completion(&done);
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