Commit b8d833a3 authored by Felipe Balbi's avatar Felipe Balbi

usb: gadget: s3c-hsotg: let udc-core manage gadget->dev

By simply setting a flag, we can drop some
boilerplate code.
Reviewed-by: default avatarTomasz Figa <tomasz.figa@gmail.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 80bf5343
...@@ -3567,17 +3567,13 @@ static int s3c_hsotg_probe(struct platform_device *pdev) ...@@ -3567,17 +3567,13 @@ static int s3c_hsotg_probe(struct platform_device *pdev)
dev_info(dev, "regs %p, irq %d\n", hsotg->regs, hsotg->irq); dev_info(dev, "regs %p, irq %d\n", hsotg->regs, hsotg->irq);
device_initialize(&hsotg->gadget.dev);
dev_set_name(&hsotg->gadget.dev, "gadget");
hsotg->gadget.max_speed = USB_SPEED_HIGH; hsotg->gadget.max_speed = USB_SPEED_HIGH;
hsotg->gadget.ops = &s3c_hsotg_gadget_ops; hsotg->gadget.ops = &s3c_hsotg_gadget_ops;
hsotg->gadget.name = dev_name(dev); hsotg->gadget.name = dev_name(dev);
hsotg->gadget.dev.parent = dev; hsotg->gadget.dev.parent = dev;
hsotg->gadget.dev.dma_mask = dev->dma_mask; hsotg->gadget.dev.dma_mask = dev->dma_mask;
hsotg->gadget.dev.release = s3c_hsotg_release; hsotg->gadget.dev.release = s3c_hsotg_release;
hsotg->gadget.register_my_device = true;
/* reset the system */ /* reset the system */
...@@ -3658,12 +3654,6 @@ static int s3c_hsotg_probe(struct platform_device *pdev) ...@@ -3658,12 +3654,6 @@ static int s3c_hsotg_probe(struct platform_device *pdev)
s3c_hsotg_phy_disable(hsotg); s3c_hsotg_phy_disable(hsotg);
ret = device_add(&hsotg->gadget.dev);
if (ret) {
put_device(&hsotg->gadget.dev);
goto err_ep_mem;
}
ret = usb_add_gadget_udc(&pdev->dev, &hsotg->gadget); ret = usb_add_gadget_udc(&pdev->dev, &hsotg->gadget);
if (ret) if (ret)
goto err_ep_mem; goto err_ep_mem;
...@@ -3702,10 +3692,8 @@ static int s3c_hsotg_remove(struct platform_device *pdev) ...@@ -3702,10 +3692,8 @@ static int s3c_hsotg_remove(struct platform_device *pdev)
} }
s3c_hsotg_phy_disable(hsotg); s3c_hsotg_phy_disable(hsotg);
clk_disable_unprepare(hsotg->clk); clk_disable_unprepare(hsotg->clk);
device_unregister(&hsotg->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