Commit 0972ef71 authored by Felipe Balbi's avatar Felipe Balbi

usb: renesas_usbhs: gadget: 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 b1e1eaba
...@@ -976,15 +976,12 @@ int usbhs_mod_gadget_probe(struct usbhs_priv *priv) ...@@ -976,15 +976,12 @@ int usbhs_mod_gadget_probe(struct usbhs_priv *priv)
/* /*
* init gadget * init gadget
*/ */
dev_set_name(&gpriv->gadget.dev, "gadget");
gpriv->gadget.dev.parent = dev; gpriv->gadget.dev.parent = dev;
gpriv->gadget.dev.release = usbhs_mod_gadget_release; gpriv->gadget.dev.release = usbhs_mod_gadget_release;
gpriv->gadget.name = "renesas_usbhs_udc"; gpriv->gadget.name = "renesas_usbhs_udc";
gpriv->gadget.ops = &usbhsg_gadget_ops; gpriv->gadget.ops = &usbhsg_gadget_ops;
gpriv->gadget.max_speed = USB_SPEED_HIGH; gpriv->gadget.max_speed = USB_SPEED_HIGH;
ret = device_register(&gpriv->gadget.dev); gpriv->gadget.register_my_device = true;
if (ret < 0)
goto err_add_udc;
INIT_LIST_HEAD(&gpriv->gadget.ep_list); INIT_LIST_HEAD(&gpriv->gadget.ep_list);
...@@ -1014,15 +1011,13 @@ int usbhs_mod_gadget_probe(struct usbhs_priv *priv) ...@@ -1014,15 +1011,13 @@ int usbhs_mod_gadget_probe(struct usbhs_priv *priv)
ret = usb_add_gadget_udc(dev, &gpriv->gadget); ret = usb_add_gadget_udc(dev, &gpriv->gadget);
if (ret) if (ret)
goto err_register; goto err_add_udc;
dev_info(dev, "gadget probed\n"); dev_info(dev, "gadget probed\n");
return 0; return 0;
err_register:
device_unregister(&gpriv->gadget.dev);
err_add_udc: err_add_udc:
kfree(gpriv->uep); kfree(gpriv->uep);
...@@ -1038,8 +1033,6 @@ void usbhs_mod_gadget_remove(struct usbhs_priv *priv) ...@@ -1038,8 +1033,6 @@ void usbhs_mod_gadget_remove(struct usbhs_priv *priv)
usb_del_gadget_udc(&gpriv->gadget); usb_del_gadget_udc(&gpriv->gadget);
device_unregister(&gpriv->gadget.dev);
kfree(gpriv->uep); kfree(gpriv->uep);
kfree(gpriv); kfree(gpriv);
} }
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