]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
usb: dwc3: gadget: Improve dwc3_gadget_suspend() and dwc3_gadget_resume()
authorRoger Quadros <rogerq@kernel.org>
Wed, 3 May 2023 11:00:48 +0000 (14:00 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 26 Aug 2023 12:23:28 +0000 (14:23 +0200)
commit20351ddb1f41cfb3ae20e105425ef43a28393d76
tree2f72f6eb1e0c5184d58722832d5d74040f9e6329
parent31a0e60fe16bc0c923aca5bd90f437046544be23
usb: dwc3: gadget: Improve dwc3_gadget_suspend() and dwc3_gadget_resume()

[ Upstream commit c8540870af4ce6ddeb27a7bb5498b75fb29b643c ]

Prevent -ETIMEDOUT error on .suspend().
e.g. If gadget driver is loaded and we are connected to a USB host,
all transfers must be stopped before stopping the controller else
we will not get a clean stop i.e. dwc3_gadget_run_stop() will take
several seconds to complete and will return -ETIMEDOUT.

Handle error cases properly in dwc3_gadget_suspend().
Simplify dwc3_gadget_resume() by using the introduced helper function.

Fixes: 9f8a67b65a49 ("usb: dwc3: gadget: fix gadget suspend/resume")
Cc: stable@vger.kernel.org
Suggested-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Signed-off-by: Roger Quadros <rogerq@kernel.org>
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/20230503110048.30617-1-rogerq@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/usb/dwc3/gadget.c