summaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3/gadget.c
diff options
context:
space:
mode:
authorWesley Cheng <quic_wcheng@quicinc.com>2022-09-01 21:36:22 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-09-07 16:26:44 +0200
commit5265397f94424eaea596026fd34dc7acf474dcec (patch)
treecef5c5b941a56d543af72c89d6ba7780b83af37c /drivers/usb/dwc3/gadget.c
parentusb: dwc3: Avoid unmapping USB requests if endxfer is not complete (diff)
downloadlinux-5265397f94424eaea596026fd34dc7acf474dcec.tar.xz
linux-5265397f94424eaea596026fd34dc7acf474dcec.zip
usb: dwc3: Remove DWC3 locking during gadget suspend/resume
Remove the need for making dwc3_gadget_suspend() and dwc3_gadget_resume() to be called in a spinlock, as dwc3_gadget_run_stop() could potentially take some time to complete. Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com> Link: https://lore.kernel.org/r/20220901193625.8727-3-quic_wcheng@quicinc.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/dwc3/gadget.c')
-rw-r--r--drivers/usb/dwc3/gadget.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index b9189045e4cb..9077c6c2eb0f 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -4522,12 +4522,17 @@ void dwc3_gadget_exit(struct dwc3 *dwc)
int dwc3_gadget_suspend(struct dwc3 *dwc)
{
+ unsigned long flags;
+
if (!dwc->gadget_driver)
return 0;
dwc3_gadget_run_stop(dwc, false, false);
+
+ spin_lock_irqsave(&dwc->lock, flags);
dwc3_disconnect_gadget(dwc);
__dwc3_gadget_stop(dwc);
+ spin_unlock_irqrestore(&dwc->lock, flags);
return 0;
}