diff options
author | Felipe Balbi <balbi@ti.com> | 2013-01-24 10:08:01 -0500 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2013-03-18 05:16:53 -0400 |
commit | 0972ef71b4841a59fab6f998d6e6c2c684443583 (patch) | |
tree | e73fbbda5009e67e2f0337a67c533762d645aeb0 /drivers/usb/renesas_usbhs | |
parent | b1e1eaba2916427d25fbd411cd863052836560ff (diff) |
usb: renesas_usbhs: gadget: 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/renesas_usbhs')
-rw-r--r-- | drivers/usb/renesas_usbhs/mod_gadget.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c index 78fca978b2d0..5d5fab0ad0d1 100644 --- a/drivers/usb/renesas_usbhs/mod_gadget.c +++ b/drivers/usb/renesas_usbhs/mod_gadget.c | |||
@@ -976,15 +976,12 @@ int usbhs_mod_gadget_probe(struct usbhs_priv *priv) | |||
976 | /* | 976 | /* |
977 | * init gadget | 977 | * init gadget |
978 | */ | 978 | */ |
979 | dev_set_name(&gpriv->gadget.dev, "gadget"); | ||
980 | gpriv->gadget.dev.parent = dev; | 979 | gpriv->gadget.dev.parent = dev; |
981 | gpriv->gadget.dev.release = usbhs_mod_gadget_release; | 980 | gpriv->gadget.dev.release = usbhs_mod_gadget_release; |
982 | gpriv->gadget.name = "renesas_usbhs_udc"; | 981 | gpriv->gadget.name = "renesas_usbhs_udc"; |
983 | gpriv->gadget.ops = &usbhsg_gadget_ops; | 982 | gpriv->gadget.ops = &usbhsg_gadget_ops; |
984 | gpriv->gadget.max_speed = USB_SPEED_HIGH; | 983 | gpriv->gadget.max_speed = USB_SPEED_HIGH; |
985 | ret = device_register(&gpriv->gadget.dev); | 984 | gpriv->gadget.register_my_device = true; |
986 | if (ret < 0) | ||
987 | goto err_add_udc; | ||
988 | 985 | ||
989 | INIT_LIST_HEAD(&gpriv->gadget.ep_list); | 986 | INIT_LIST_HEAD(&gpriv->gadget.ep_list); |
990 | 987 | ||
@@ -1014,15 +1011,13 @@ int usbhs_mod_gadget_probe(struct usbhs_priv *priv) | |||
1014 | 1011 | ||
1015 | ret = usb_add_gadget_udc(dev, &gpriv->gadget); | 1012 | ret = usb_add_gadget_udc(dev, &gpriv->gadget); |
1016 | if (ret) | 1013 | if (ret) |
1017 | goto err_register; | 1014 | goto err_add_udc; |
1018 | 1015 | ||
1019 | 1016 | ||
1020 | dev_info(dev, "gadget probed\n"); | 1017 | dev_info(dev, "gadget probed\n"); |
1021 | 1018 | ||
1022 | return 0; | 1019 | return 0; |
1023 | 1020 | ||
1024 | err_register: | ||
1025 | device_unregister(&gpriv->gadget.dev); | ||
1026 | err_add_udc: | 1021 | err_add_udc: |
1027 | kfree(gpriv->uep); | 1022 | kfree(gpriv->uep); |
1028 | 1023 | ||
@@ -1038,8 +1033,6 @@ void usbhs_mod_gadget_remove(struct usbhs_priv *priv) | |||
1038 | 1033 | ||
1039 | usb_del_gadget_udc(&gpriv->gadget); | 1034 | usb_del_gadget_udc(&gpriv->gadget); |
1040 | 1035 | ||
1041 | device_unregister(&gpriv->gadget.dev); | ||
1042 | |||
1043 | kfree(gpriv->uep); | 1036 | kfree(gpriv->uep); |
1044 | kfree(gpriv); | 1037 | kfree(gpriv); |
1045 | } | 1038 | } |