]> git.baikalelectronics.ru Git - kernel.git/commit
usb: dwc3: allocate gadget structure dynamically
authorPeter Chen <peter.chen@nxp.com>
Fri, 21 Aug 2020 02:55:48 +0000 (10:55 +0800)
committerFelipe Balbi <balbi@kernel.org>
Fri, 2 Oct 2020 06:57:42 +0000 (09:57 +0300)
commit738d41e35de0309e735c1faaca6c06eb0cf4edbd
tree4df35b09f38a78e71a14a9f5c7c6db7aa161c15a
parent07695f3c821c3b2463626b9881b94bb755b8fa56
usb: dwc3: allocate gadget structure dynamically

The current code uses commit 70fc83fc0e7f ("usb: udc: allow adding
and removing the same gadget device") as the workaround to let
the gadget device is re-used, but it is not allowed from driver
core point. In this commit, we allocate gadget structure dynamically,
and free it at its release function. Since the gadget device's
driver_data has already occupied by usb_composite_dev structure, we have
to use gadget device's platform data to store dwc3 structure.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Alan Stern <stern@rowland.harvard.edu>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
drivers/usb/dwc3/core.h
drivers/usb/dwc3/ep0.c
drivers/usb/dwc3/gadget.c
drivers/usb/dwc3/gadget.h