Commit 5ed01c64 authored by Felipe Balbi's avatar Felipe Balbi

usb: musb: gadget: let udc-core manage gadget-dev

By simply setting a flag, we can delete a little
boilerplate code.
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 1e1930bd
...@@ -1887,12 +1887,11 @@ int musb_gadget_setup(struct musb *musb) ...@@ -1887,12 +1887,11 @@ int musb_gadget_setup(struct musb *musb)
musb->g.speed = USB_SPEED_UNKNOWN; musb->g.speed = USB_SPEED_UNKNOWN;
/* this "gadget" abstracts/virtualizes the controller */ /* this "gadget" abstracts/virtualizes the controller */
dev_set_name(&musb->g.dev, "gadget");
musb->g.dev.parent = musb->controller; musb->g.dev.parent = musb->controller;
musb->g.dev.dma_mask = musb->controller->dma_mask; musb->g.dev.dma_mask = musb->controller->dma_mask;
musb->g.dev.release = musb_gadget_release; musb->g.dev.release = musb_gadget_release;
musb->g.name = musb_driver_name; musb->g.name = musb_driver_name;
musb->g.register_my_device = true;
musb->g.is_otg = 1; musb->g.is_otg = 1;
musb_g_init_endpoints(musb); musb_g_init_endpoints(musb);
...@@ -1900,11 +1899,6 @@ int musb_gadget_setup(struct musb *musb) ...@@ -1900,11 +1899,6 @@ int musb_gadget_setup(struct musb *musb)
musb->is_active = 0; musb->is_active = 0;
musb_platform_try_idle(musb, 0); musb_platform_try_idle(musb, 0);
status = device_register(&musb->g.dev);
if (status != 0) {
put_device(&musb->g.dev);
return status;
}
status = usb_add_gadget_udc(musb->controller, &musb->g); status = usb_add_gadget_udc(musb->controller, &musb->g);
if (status) if (status)
goto err; goto err;
...@@ -1919,8 +1913,6 @@ int musb_gadget_setup(struct musb *musb) ...@@ -1919,8 +1913,6 @@ int musb_gadget_setup(struct musb *musb)
void musb_gadget_cleanup(struct musb *musb) void musb_gadget_cleanup(struct musb *musb)
{ {
usb_del_gadget_udc(&musb->g); usb_del_gadget_udc(&musb->g);
if (musb->g.dev.parent)
device_unregister(&musb->g.dev);
} }
/* /*
......
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