summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget/dummy_hcd.c
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2013-01-24 18:10:16 +0400
committerFelipe Balbi <balbi@ti.com>2013-03-18 13:16:43 +0400
commit002cb13f4a6f3c28510575922a226a7a09ab6e91 (patch)
tree636c54af38a39b2f39a720a85174dd9383c9961f /drivers/usb/gadget/dummy_hcd.c
parent9b4ead05e7a3abf350d4ca1f7e0b71dc44f07f57 (diff)
downloadlinux-002cb13f4a6f3c28510575922a226a7a09ab6e91.tar.xz
usb: gadget: dummy_hcd: let udc-core manage gadget->dev
By simply setting a flag, we can drop some boilerplate code. Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/dummy_hcd.c')
-rw-r--r--drivers/usb/gadget/dummy_hcd.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index 8cf0c0f6fa1f..a6950aa8f3be 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -983,16 +983,10 @@ static int dummy_udc_probe(struct platform_device *pdev)
dum->gadget.name = gadget_name;
dum->gadget.ops = &dummy_ops;
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.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);
rc = usb_add_gadget_udc(&pdev->dev, &dum->gadget);
@@ -1008,7 +1002,6 @@ static int dummy_udc_probe(struct platform_device *pdev)
err_dev:
usb_del_gadget_udc(&dum->gadget);
err_udc:
- device_unregister(&dum->gadget.dev);
return rc;
}
@@ -1019,7 +1012,6 @@ static int dummy_udc_remove(struct platform_device *pdev)
usb_del_gadget_udc(&dum->gadget);
platform_set_drvdata(pdev, NULL);
device_remove_file(&dum->gadget.dev, &dev_attr_function);
- device_unregister(&dum->gadget.dev);
return 0;
}