usb: dwc3: core: don't do suspend for device mode if already suspended
authorLi Jun <jun.li@nxp.com>
Wed, 19 Feb 2020 16:20:04 +0000 (00:20 +0800)
committerFelipe Balbi <balbi@kernel.org>
Sun, 15 Mar 2020 09:31:36 +0000 (11:31 +0200)
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>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
drivers/usb/dwc3/core.c

index e6879a3..edc1715 100644 (file)
@@ -1632,6 +1632,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);