usb: dwc3: move synchronize_irq() out of the spinlock protected
block

dwc3_gadget_suspend() is called under dwc->lock spinlock. In
such context calling synchronize_irq() is not allowed. Move the
problematic call out of the protected block.
Fixes: 01c10880d242 ("usb: dwc3: gadget: synchronize_irq dwc irq in
suspend")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Bug: 118693272
Change-Id: I6aaaa86b1b90e4346bd885135049823882c781cb
Signed-off-by: Leonid Lobachev <leonidl@google.com>
(cherry picked from commit f96d53643694e141c51f320957d8f219498c2e8f)
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 95b79c7..9b0b153 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -1383,6 +1383,7 @@
 		spin_lock_irqsave(&dwc->lock, flags);
 		dwc3_gadget_suspend(dwc);
 		spin_unlock_irqrestore(&dwc->lock, flags);
+		synchronize_irq(dwc->irq_gadget);
 		dwc3_core_exit(dwc);
 		break;
 	case DWC3_GCTL_PRTCAP_HOST:
@@ -1408,6 +1409,7 @@
 		spin_lock_irqsave(&dwc->lock, flags);
 		dwc3_gadget_resume(dwc);
 		spin_unlock_irqrestore(&dwc->lock, flags);
+		synchronize_irq(dwc->irq_gadget);
 		break;
 	case DWC3_GCTL_PRTCAP_HOST:
 	default:
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 8f71f0a..23d461a 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -3344,8 +3344,6 @@
 	dwc3_disconnect_gadget(dwc);
 	__dwc3_gadget_stop(dwc);
 
-	synchronize_irq(dwc->irq_gadget);
-
 	return 0;
 }