Commit 002cb13f authored by Felipe Balbi's avatar Felipe Balbi

usb: gadget: dummy_hcd: 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 9b4ead05
...@@ -983,16 +983,10 @@ static int dummy_udc_probe(struct platform_device *pdev) ...@@ -983,16 +983,10 @@ static int dummy_udc_probe(struct platform_device *pdev)
dum->gadget.name = gadget_name; dum->gadget.name = gadget_name;
dum->gadget.ops = &dummy_ops; dum->gadget.ops = &dummy_ops;
dum->gadget.max_speed = USB_SPEED_SUPER; dum->gadget.max_speed = USB_SPEED_SUPER;
dum->gadget.register_my_device = true;
dev_set_name(&dum->gadget.dev, "gadget");
dum->gadget.dev.parent = &pdev->dev; dum->gadget.dev.parent = &pdev->dev;
dum->gadget.dev.release = dummy_gadget_release; dum->gadget.dev.release = dummy_gadget_release;
rc = device_register(&dum->gadget.dev);
if (rc < 0) {
put_device(&dum->gadget.dev);
return rc;
}
init_dummy_udc_hw(dum); init_dummy_udc_hw(dum);
rc = usb_add_gadget_udc(&pdev->dev, &dum->gadget); rc = usb_add_gadget_udc(&pdev->dev, &dum->gadget);
...@@ -1008,7 +1002,6 @@ static int dummy_udc_probe(struct platform_device *pdev) ...@@ -1008,7 +1002,6 @@ static int dummy_udc_probe(struct platform_device *pdev)
err_dev: err_dev:
usb_del_gadget_udc(&dum->gadget); usb_del_gadget_udc(&dum->gadget);
err_udc: err_udc:
device_unregister(&dum->gadget.dev);
return rc; return rc;
} }
...@@ -1019,7 +1012,6 @@ static int dummy_udc_remove(struct platform_device *pdev) ...@@ -1019,7 +1012,6 @@ static int dummy_udc_remove(struct platform_device *pdev)
usb_del_gadget_udc(&dum->gadget); usb_del_gadget_udc(&dum->gadget);
platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL);
device_remove_file(&dum->gadget.dev, &dev_attr_function); device_remove_file(&dum->gadget.dev, &dev_attr_function);
device_unregister(&dum->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