usb: dwc3: gadget: improve increment request->actual
authorFelipe Balbi <felipe.balbi@linux.intel.com>
Fri, 12 Aug 2016 10:20:32 +0000 (13:20 +0300)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Thu, 25 Aug 2016 09:13:06 +0000 (12:13 +0300)
No functional changes, just a slight cosmetic
change.

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

index 835a5dcb84608730e4af650ab406fa344edc0182..0288ea99c85ae1a383bc7f8f5387dc6ba09c7f76 100644 (file)
@@ -1860,6 +1860,7 @@ static int __dwc3_cleanup_done_trbs(struct dwc3 *dwc, struct dwc3_ep *dep,
        unsigned int            trb_status;
 
        dep->queued_requests--;
+       dwc3_ep_inc_deq(dep);
        trace_dwc3_complete_trb(dep, trb);
 
        /*
@@ -1879,6 +1880,7 @@ static int __dwc3_cleanup_done_trbs(struct dwc3 *dwc, struct dwc3_ep *dep,
                return 1;
 
        count = trb->size & DWC3_TRB_SIZE_MASK;
+       req->request.actual += count;
 
        if (dep->direction) {
                if (count) {
@@ -1931,7 +1933,6 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, struct dwc3_ep *dep,
 {
        struct dwc3_request     *req, *n;
        struct dwc3_trb         *trb;
-       int                     count = 0;
        int                     ret;
 
        list_for_each_entry_safe(req, n, &dep->started_list, list) {
@@ -1949,8 +1950,6 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, struct dwc3_ep *dep,
 
                        for_each_sg(sg, s, pending, i) {
                                trb = &dep->trb_pool[dep->trb_dequeue];
-                               count += trb->size & DWC3_TRB_SIZE_MASK;
-                               dwc3_ep_inc_deq(dep);
 
                                req->sg = sg_next(s);
                                req->num_pending_sgs--;
@@ -1962,9 +1961,6 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, struct dwc3_ep *dep,
                        }
                } else {
                        trb = &dep->trb_pool[dep->trb_dequeue];
-                       count += trb->size & DWC3_TRB_SIZE_MASK;
-                       dwc3_ep_inc_deq(dep);
-
                        ret = __dwc3_cleanup_done_trbs(dwc, dep, req, trb,
                                        event, status, chain);
                }