Commit 103495aa authored by Heiko Stübner's avatar Heiko Stübner Committed by Felipe Balbi

usb: gadget: s3c-hsudc: move device registration to probe

Instead of adding and deleting the gadget device in the start and stop
invocations. Use device_register in the probe method to initialize
and add the gadget device.
Signed-off-by: default avatarHeiko Stuebner <heiko@sntech.de>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent e9bcb9e5
...@@ -1156,11 +1156,6 @@ static int s3c_hsudc_start(struct usb_gadget_driver *driver, ...@@ -1156,11 +1156,6 @@ static int s3c_hsudc_start(struct usb_gadget_driver *driver,
hsudc->driver = driver; hsudc->driver = driver;
hsudc->gadget.dev.driver = &driver->driver; hsudc->gadget.dev.driver = &driver->driver;
hsudc->gadget.speed = USB_SPEED_UNKNOWN; hsudc->gadget.speed = USB_SPEED_UNKNOWN;
ret = device_add(&hsudc->gadget.dev);
if (ret) {
dev_err(hsudc->dev, "failed to probe gadget device");
return ret;
}
ret = bind(&hsudc->gadget); ret = bind(&hsudc->gadget);
if (ret) { if (ret) {
...@@ -1180,8 +1175,6 @@ static int s3c_hsudc_start(struct usb_gadget_driver *driver, ...@@ -1180,8 +1175,6 @@ static int s3c_hsudc_start(struct usb_gadget_driver *driver,
hsudc->gadget.name); hsudc->gadget.name);
driver->unbind(&hsudc->gadget); driver->unbind(&hsudc->gadget);
device_del(&hsudc->gadget.dev);
hsudc->driver = NULL; hsudc->driver = NULL;
hsudc->gadget.dev.driver = NULL; hsudc->gadget.dev.driver = NULL;
return ret; return ret;
...@@ -1222,7 +1215,6 @@ static int s3c_hsudc_stop(struct usb_gadget_driver *driver) ...@@ -1222,7 +1215,6 @@ static int s3c_hsudc_stop(struct usb_gadget_driver *driver)
(void) otg_set_peripheral(hsudc->transceiver, NULL); (void) otg_set_peripheral(hsudc->transceiver, NULL);
driver->unbind(&hsudc->gadget); driver->unbind(&hsudc->gadget);
device_del(&hsudc->gadget.dev);
disable_irq(hsudc->irq); disable_irq(hsudc->irq);
dev_info(hsudc->dev, "unregistered gadget driver '%s'\n", dev_info(hsudc->dev, "unregistered gadget driver '%s'\n",
...@@ -1307,7 +1299,6 @@ static int __devinit s3c_hsudc_probe(struct platform_device *pdev) ...@@ -1307,7 +1299,6 @@ static int __devinit s3c_hsudc_probe(struct platform_device *pdev)
spin_lock_init(&hsudc->lock); spin_lock_init(&hsudc->lock);
device_initialize(&hsudc->gadget.dev);
dev_set_name(&hsudc->gadget.dev, "gadget"); dev_set_name(&hsudc->gadget.dev, "gadget");
hsudc->gadget.max_speed = USB_SPEED_HIGH; hsudc->gadget.max_speed = USB_SPEED_HIGH;
...@@ -1348,12 +1339,20 @@ static int __devinit s3c_hsudc_probe(struct platform_device *pdev) ...@@ -1348,12 +1339,20 @@ static int __devinit s3c_hsudc_probe(struct platform_device *pdev)
disable_irq(hsudc->irq); disable_irq(hsudc->irq);
local_irq_enable(); local_irq_enable();
ret = device_register(&hsudc->gadget.dev);
if (ret) {
put_device(&hsudc->gadget.dev);
goto err_add_device;
}
ret = usb_add_gadget_udc(&pdev->dev, &hsudc->gadget); ret = usb_add_gadget_udc(&pdev->dev, &hsudc->gadget);
if (ret) if (ret)
goto err_add_udc; goto err_add_udc;
return 0; return 0;
err_add_udc: err_add_udc:
device_unregister(&hsudc->gadget.dev);
err_add_device:
clk_disable(hsudc->uclk); clk_disable(hsudc->uclk);
clk_put(hsudc->uclk); clk_put(hsudc->uclk);
err_clk: err_clk:
......
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