summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Balbi <felipe.balbi@linux.intel.com>2016-08-24 11:37:22 (GMT)
committerFelipe Balbi <felipe.balbi@linux.intel.com>2016-08-25 09:13:20 (GMT)
commit7ae7df4982af6aed25c5e9e71b91027a494149de (patch)
tree14507120e6cbc5056ab9225f4e48cfc6a3e701de
parentba1582f22231821c57534e87b077d84adbc15dbd (diff)
downloadlinux-7ae7df4982af6aed25c5e9e71b91027a494149de.tar.xz
usb: dwc3: gadget: abolish trbs_left
Instead, we can always rely on dwc3_calc_trbs_left() directly. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
-rw-r--r--drivers/usb/dwc3/gadget.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 161a6bf..104b145 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -886,7 +886,7 @@ static u32 dwc3_calc_trbs_left(struct dwc3_ep *dep)
}
static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep,
- struct dwc3_request *req, unsigned int trbs_left)
+ struct dwc3_request *req)
{
struct scatterlist *sg = req->sg;
struct scatterlist *s;
@@ -906,13 +906,13 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep,
dwc3_prepare_one_trb(dep, req, dma, length,
chain, i);
- if (!trbs_left--)
+ if (!dwc3_calc_trbs_left(dep))
break;
}
}
static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep,
- struct dwc3_request *req, unsigned int trbs_left)
+ struct dwc3_request *req)
{
unsigned int length;
dma_addr_t dma;
@@ -935,21 +935,19 @@ static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep,
static void dwc3_prepare_trbs(struct dwc3_ep *dep)
{
struct dwc3_request *req, *n;
- u32 trbs_left;
BUILD_BUG_ON_NOT_POWER_OF_2(DWC3_TRB_NUM);
- trbs_left = dwc3_calc_trbs_left(dep);
- if (!trbs_left)
+ if (!dwc3_calc_trbs_left(dep))
return;
list_for_each_entry_safe(req, n, &dep->pending_list, list) {
if (req->num_pending_sgs > 0)
- dwc3_prepare_one_trb_sg(dep, req, trbs_left--);
+ dwc3_prepare_one_trb_sg(dep, req);
else
- dwc3_prepare_one_trb_linear(dep, req, trbs_left--);
+ dwc3_prepare_one_trb_linear(dep, req);
- if (!trbs_left)
+ if (!dwc3_calc_trbs_left(dep))
return;
}
}