usb: dwc3: gadget: drop unnecessary loop when cleaning up TRBs
authorFelipe Balbi <balbi@ti.com>
Thu, 4 Sep 2014 18:14:49 +0000 (13:14 -0500)
committerFelipe Balbi <balbi@ti.com>
Mon, 9 Mar 2015 15:38:49 +0000 (10:38 -0500)
Now that we're using XFERINPROGRESS for all endpoint
types (except Control), we will *always* be completing
one TRB at a time, so it's safe to remove the loop
from dwc3_cleanup_done_reqs.

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

index a03a485205c787c74812f14337096b2831223cbc..8946c32047e996308e3a752c8dd0ce7f501c3909 100644 (file)
@@ -1855,32 +1855,27 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, struct dwc3_ep *dep,
        unsigned int            i;
        int                     ret;
 
+       req = next_request(&dep->req_queued);
+       if (!req) {
+               WARN_ON_ONCE(1);
+               return 1;
+       }
+       i = 0;
        do {
-               req = next_request(&dep->req_queued);
-               if (!req) {
-                       WARN_ON_ONCE(1);
-                       return 1;
-               }
-               i = 0;
-               do {
-                       slot = req->start_slot + i;
-                       if ((slot == DWC3_TRB_NUM - 1) &&
+               slot = req->start_slot + i;
+               if ((slot == DWC3_TRB_NUM - 1) &&
                                usb_endpoint_xfer_isoc(dep->endpoint.desc))
-                               slot++;
-                       slot %= DWC3_TRB_NUM;
-                       trb = &dep->trb_pool[slot];
-
-                       ret = __dwc3_cleanup_done_trbs(dwc, dep, req, trb,
-                                       event, status);
-                       if (ret)
-                               break;
-               }while (++i < req->request.num_mapped_sgs);
-
-               dwc3_gadget_giveback(dep, req, status);
+                       slot++;
+               slot %= DWC3_TRB_NUM;
+               trb = &dep->trb_pool[slot];
 
+               ret = __dwc3_cleanup_done_trbs(dwc, dep, req, trb,
+                               event, status);
                if (ret)
                        break;
-       } while (1);
+       } while (++i < req->request.num_mapped_sgs);
+
+       dwc3_gadget_giveback(dep, req, status);
 
        if (usb_endpoint_xfer_isoc(dep->endpoint.desc) &&
                        list_empty(&dep->req_queued)) {