From: Gregory Herrero <gregory.herr...@intel.com>

In case controller is asked to stop while devices are connected,
disconnect all devices and clean up before stopping.

Signed-off-by: Gregory Herrero <gregory.herr...@intel.com>
Signed-off-by: Mian Yousaf Kaukab <yousaf.kau...@intel.com>
Tested-by: Robert Baldyga <r.bald...@samsung.com>
---
 drivers/usb/dwc2/hcd.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
index 856e21c..257f957 100644
--- a/drivers/usb/dwc2/hcd.c
+++ b/drivers/usb/dwc2/hcd.c
@@ -2350,7 +2350,12 @@ static void _dwc2_hcd_stop(struct usb_hcd *hcd)
        struct dwc2_hsotg *hsotg = dwc2_hcd_to_hsotg(hcd);
        unsigned long flags;
 
+       /* Wait for interrupt processing to finish */
+       synchronize_irq(hcd->irq);
+
        spin_lock_irqsave(&hsotg->lock, flags);
+       /* Ensure hcd is disconnected */
+       dwc2_hcd_disconnect(hsotg);
        dwc2_hcd_stop(hsotg);
        hsotg->lx_state = DWC2_L3;
        hcd->state = HC_STATE_HALT;
-- 
2.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to