mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-30 13:38:40 +00:00
usb: dwc3: gadget: let udc-core manage gadget->dev
We don't need to register that device ourselves if we simply set gadget->register_my_device. Signed-off-by: Felipe Balbi <balbi@ti.com>
This commit is contained in:
parent
f07bd56bbd
commit
1e1930bd3d
@ -2488,8 +2488,6 @@ int dwc3_gadget_init(struct dwc3 *dwc)
|
|||||||
goto err3;
|
goto err3;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev_set_name(&dwc->gadget.dev, "gadget");
|
|
||||||
|
|
||||||
dwc->gadget.ops = &dwc3_gadget_ops;
|
dwc->gadget.ops = &dwc3_gadget_ops;
|
||||||
dwc->gadget.max_speed = USB_SPEED_SUPER;
|
dwc->gadget.max_speed = USB_SPEED_SUPER;
|
||||||
dwc->gadget.speed = USB_SPEED_UNKNOWN;
|
dwc->gadget.speed = USB_SPEED_UNKNOWN;
|
||||||
@ -2501,6 +2499,7 @@ int dwc3_gadget_init(struct dwc3 *dwc)
|
|||||||
dwc->gadget.dev.dma_parms = dwc->dev->dma_parms;
|
dwc->gadget.dev.dma_parms = dwc->dev->dma_parms;
|
||||||
dwc->gadget.dev.dma_mask = dwc->dev->dma_mask;
|
dwc->gadget.dev.dma_mask = dwc->dev->dma_mask;
|
||||||
dwc->gadget.dev.release = dwc3_gadget_release;
|
dwc->gadget.dev.release = dwc3_gadget_release;
|
||||||
|
dwc->gadget.register_my_device = true;
|
||||||
dwc->gadget.name = "dwc3-gadget";
|
dwc->gadget.name = "dwc3-gadget";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2544,24 +2543,14 @@ int dwc3_gadget_init(struct dwc3 *dwc)
|
|||||||
dwc3_gadget_usb3_phy_suspend(dwc, false);
|
dwc3_gadget_usb3_phy_suspend(dwc, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = device_register(&dwc->gadget.dev);
|
|
||||||
if (ret) {
|
|
||||||
dev_err(dwc->dev, "failed to register gadget device\n");
|
|
||||||
put_device(&dwc->gadget.dev);
|
|
||||||
goto err6;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = usb_add_gadget_udc(dwc->dev, &dwc->gadget);
|
ret = usb_add_gadget_udc(dwc->dev, &dwc->gadget);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(dwc->dev, "failed to register udc\n");
|
dev_err(dwc->dev, "failed to register udc\n");
|
||||||
goto err7;
|
goto err6;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err7:
|
|
||||||
device_unregister(&dwc->gadget.dev);
|
|
||||||
|
|
||||||
err6:
|
err6:
|
||||||
dwc3_writel(dwc->regs, DWC3_DEVTEN, 0x00);
|
dwc3_writel(dwc->regs, DWC3_DEVTEN, 0x00);
|
||||||
free_irq(irq, dwc);
|
free_irq(irq, dwc);
|
||||||
@ -2610,6 +2599,4 @@ void dwc3_gadget_exit(struct dwc3 *dwc)
|
|||||||
|
|
||||||
dma_free_coherent(dwc->dev, sizeof(*dwc->ctrl_req),
|
dma_free_coherent(dwc->dev, sizeof(*dwc->ctrl_req),
|
||||||
dwc->ctrl_req, dwc->ctrl_req_addr);
|
dwc->ctrl_req, dwc->ctrl_req_addr);
|
||||||
|
|
||||||
device_unregister(&dwc->gadget.dev);
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user