[PATCH 06/22] usb: dwc3: gadget: rely on sg_is_last() and list_is_last()

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

 



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@xxxxxxxxxxxxxxx>
---
 drivers/usb/dwc3/gadget.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 3640808e326d..fab2d166d844 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -918,10 +918,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;
 				}
 
@@ -947,11 +947,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);
-- 
2.8.2

---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki 
Business Identity Code: 0357606 - 4 
Domiciled in Helsinki 

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
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