[PATCH] usb: dwc3: wait for end transfer to complete before disable irq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Chuansheng Liu <chuansheng.liu@xxxxxxxxx>

Currently, in "for (epnum = 2; epnum < DWC3_ENDPOINTS_NUM; epnum++)",
it is waiting the DWC3_EP_END_TRANSFER_PENDING flag to be 0 which is
cleared in dwc3_endpoint_interrupt(). However, before that,the dwc3 irq
was disabled which reasult this flag will not be cleared.

This patch moves "for (epnum = 2; epnum < DWC3_ENDPOINTS_NUM; epnum++)"
ahead of "dwc3_gadget_disable_irq(dwc)" to fix this case.

Signed-off-by: Chuansheng Liu <chuansheng.liu@xxxxxxxxx>
Signed-off-by: Zhen Han <zhen.han@xxxxxxxxx>
---
 drivers/usb/dwc3/gadget.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 725b13a..d87825f 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1845,8 +1845,6 @@ static int dwc3_gadget_stop(struct usb_gadget *g)
 	if (pm_runtime_suspended(dwc->dev))
 		goto out;
 
-	__dwc3_gadget_stop(dwc);
-
 	for (epnum = 2; epnum < DWC3_ENDPOINTS_NUM; epnum++) {
 		struct dwc3_ep  *dep = dwc->eps[epnum];
 
@@ -1861,6 +1859,8 @@ static int dwc3_gadget_stop(struct usb_gadget *g)
 				    dwc->lock);
 	}
 
+	__dwc3_gadget_stop(dwc);
+
 out:
 	dwc->gadget_driver	= NULL;
 	spin_unlock_irqrestore(&dwc->lock, flags);
-- 
1.9.1

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



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux