]> git.karo-electronics.de Git - linux-beck.git/commitdiff
usb: dwc3: gadget: rely on sg_is_last() and list_is_last()
authorFelipe Balbi <felipe.balbi@linux.intel.com>
Fri, 13 May 2016 07:07:47 +0000 (10:07 +0300)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Mon, 20 Jun 2016 09:30:05 +0000 (12:30 +0300)
sg_is_last() and list_is_last() will encode the
required information for the driver to make
decisions WRT CHN and LST bits.

While at that, also replace '1' with 'true' for
consistency.

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

index f82882023d54ca0e9a91a63af3caf89e80c17d7e..8ca3855e09a6eadde5bfe236566ecb85810f5088 100644 (file)
@@ -940,10 +940,10 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep)
                                length = sg_dma_len(s);
                                dma = sg_dma_address(s);
 
-                               if (i == (request->num_mapped_sgs - 1) ||
-                                               sg_is_last(s)) {
-                                       if (list_empty(&dep->pending_list))
+                               if (sg_is_last(s)) {
+                                       if (list_is_last(&req->list, &dep->pending_list))
                                                last_one = true;
+
                                        chain = false;
                                }
 
@@ -969,11 +969,11 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep)
                        trbs_left--;
 
                        if (!trbs_left)
-                               last_one = 1;
+                               last_one = true;
 
                        /* Is this the last request? */
                        if (list_is_last(&req->list, &dep->pending_list))
-                               last_one = 1;
+                               last_one = true;
 
                        dwc3_prepare_one_trb(dep, req, dma, length,
                                        last_one, false, 0);