From: Gregory Herrero Date: Tue, 22 Sep 2015 13:16:46 +0000 (+0200) Subject: usb: dwc2: host: disconnect hcd prior stopping it X-Git-Tag: firefly_0821_release~176^2~804^2~12^2~65 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=091473ad9b402f9e1b08a68a78b54e0d3c9affb6;p=firefly-linux-kernel-4.4.55.git usb: dwc2: host: disconnect hcd prior stopping it In case controller is asked to stop while devices are connected, disconnect all devices and clean up before stopping. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Youn Signed-off-by: Felipe Balbi --- diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index 856e21cb6683..257f9579705d 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;