diff mbox series

usb: dwc3: core: don't do suspend for device mode if already suspended

Message ID 1582129204-22528-1-git-send-email-jun.li@nxp.com (mailing list archive)
State Mainlined
Commit 0227cc84c44417a29c8102e41db8ec2c11ebc6b2
Headers show
Series usb: dwc3: core: don't do suspend for device mode if already suspended | expand

Commit Message

Jun Li Feb. 19, 2020, 4:20 p.m. UTC
From: Li Jun <jun.li@nxp.com>

If dwc->dev in device mode already runtime suspended, don't do it again
for system suspend.

Signed-off-by: Li Jun <jun.li@nxp.com>
---
 drivers/usb/dwc3/core.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 1d85c42..51dc844 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -1637,6 +1637,8 @@  static int dwc3_suspend_common(struct dwc3 *dwc, pm_message_t msg)
 
 	switch (dwc->current_dr_role) {
 	case DWC3_GCTL_PRTCAP_DEVICE:
+		if (pm_runtime_suspended(dwc->dev))
+			break;
 		spin_lock_irqsave(&dwc->lock, flags);
 		dwc3_gadget_suspend(dwc);
 		spin_unlock_irqrestore(&dwc->lock, flags);