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>
This commit is contained in:
John Youn 2016-05-19 17:26:15 -07:00 committed by Felipe Balbi
parent 32db3d9437
commit 7d0a038b13

View file

@ -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;
}