From: Felipe Balbi Date: Fri, 13 May 2016 07:07:47 +0000 (+0300) Subject: UPSTREAM: usb: dwc3: gadget: rely on sg_is_last() and list_is_last() X-Git-Tag: firefly_0821_release~1835 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a8d6bbd8c6300e784d43fd13b75c4b191e7dbfa1;p=firefly-linux-kernel-4.4.55.git UPSTREAM: usb: dwc3: gadget: rely on sg_is_last() and list_is_last() 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. Change-Id: I827e39df3058f696d753e03130a951017ed45bf5 Signed-off-by: Felipe Balbi Signed-off-by: Wu Liang feng (cherry picked from commit 6aff483295950abcf3be1a99f56f308bd6a1bab4) --- diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 887f2c139600..3d50b0b55adf 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -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);