summaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3
diff options
context:
space:
mode:
authorJohn Youn <johnyoun@synopsys.com>2016-05-19 17:26:15 -0700
committerFelipe Balbi <felipe.balbi@linux.intel.com>2016-06-20 12:32:44 +0300
commit7d0a038b130cde7265d6bbc5e148734cb127f341 (patch)
treeeaa98442860f754080f12d408711a993d2d281b9 /drivers/usb/dwc3
parent32db3d9437b6bd560daeef82a8325436a4ac3366 (diff)
downloadblackbird-op-linux-7d0a038b130cde7265d6bbc5e148734cb127f341.tar.gz
blackbird-op-linux-7d0a038b130cde7265d6bbc5e148734cb127f341.zip
usb: dwc3: gadget: Account for link TRB in TRBs left
The TRBs left calculation didn't account for the link TRB taking up one spot. If the trb_dequeue < trb_enqueue, then the result includes the link TRB slot so it must be adjusted. Signed-off-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers/usb/dwc3')
-rw-r--r--drivers/usb/dwc3/gadget.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 4dea3e08f95c..3c4fd4854317 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -868,6 +868,9 @@ static u32 dwc3_calc_trbs_left(struct dwc3_ep *dep)
trbs_left = dep->trb_dequeue - dep->trb_enqueue;
trbs_left %= DWC3_TRB_NUM;
+ if (dep->trb_dequeue < dep->trb_enqueue)
+ trbs_left--;
+
return trbs_left;
}
OpenPOWER on IntegriCloud