OSDN Git Service

usb: udc: core: Introduce started state
authorThinh Nguyen <Thinh.Nguyen@synopsys.com>
Mon, 11 Jan 2021 20:38:05 +0000 (12:38 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Jan 2021 11:50:20 +0000 (12:50 +0100)
commit49d08cfc7830440517216b6d51bd0c38b5314c7f
tree4cfcca3a911490241ed2ce906731cef6a564e762
parentbabbdfc9d2297b641ba8c91de1655673507736e4
usb: udc: core: Introduce started state

For some UDCs, the initialization sequence by udc_start() should not be
repeated until it is properly cleaned up with udc_stop() and vise versa.
We may run into some cleanup failure as seen with the DWC3 driver during
the irq cleanup. This issue can occur when the user triggers
soft-connect/soft-disconnect from the soft_connect sysfs. To avoid
adding checks to every UDC driver, at the UDC framework, introduce a
"started" state to track and prevent the UDC from repeating the
udc_start() and udc_stop() if it had already started/stopped.

Acked-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/a7c4112fcd4dc2f0169af94a24f5685ca77f09fd.1610395599.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/udc/core.c