usb: dwc3: giveback all queued request when ep disabled or reset received
authorPratyush Anand <pratyush.anand@st.com>
Fri, 15 Jun 2012 06:24:36 +0000 (11:54 +0530)
committerFelipe Balbi <balbi@ti.com>
Fri, 15 Jun 2012 11:43:44 +0000 (14:43 +0300)
In case of ep_disable and reset interrupt is received and, still there
was at least one request queued for dma transfer, then endpoint is
stopped first. Once endpoint is stopped, callback for all queued
request must be called.

Signed-off-by: Pratyush Anand <pratyush.anand@st.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/dwc3/gadget.c

index 38cd13ffae9d1f86e0d387b55041d3d10b7a9d8a..f6fb42da2e6494d8bcc8bfe62c1bce25f82cced9 100644 (file)
@@ -579,8 +579,11 @@ static void dwc3_remove_requests(struct dwc3 *dwc, struct dwc3_ep *dep)
                 */
                udelay(100);
 
-               req = next_request(&dep->req_queued);
-               dwc3_gadget_giveback(dep, req, -ESHUTDOWN);
+               while (!list_empty(&dep->req_queued)) {
+                       req = next_request(&dep->req_queued);
+
+                       dwc3_gadget_giveback(dep, req, -ESHUTDOWN);
+               }
        }
 
        while (!list_empty(&dep->request_list)) {