diff options
author | John Youn <johnyoun@synopsys.com> | 2016-08-26 21:43:01 -0400 |
---|---|---|
committer | Felipe Balbi <felipe.balbi@linux.intel.com> | 2016-09-05 06:39:23 -0400 |
commit | 9d7aba7786b6c9eec6d083e43fd639228c400c3a (patch) | |
tree | 8de7ea0388aaad3551d4a1981a1643836c234da9 | |
parent | c6935931c1894ff857616ff8549b61236a19148f (diff) |
Revert "usb: dwc3: gadget: always decrement by 1"
This reverts commit 6f8245b4e37c ("usb: dwc3: gadget: always decrement
by 1").
We can't always decrement this value.
We should decrement only if the calculation of free slots results in a
LINK TRB being among one of the free slots (dequeue < enqueue).
Otherwise, if the LINK TRB is not among the free slots then it should
not be decremented.
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
-rw-r--r-- | drivers/usb/dwc3/gadget.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 7a8d3d822b54..122e64df2f4d 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
@@ -884,9 +884,12 @@ static u32 dwc3_calc_trbs_left(struct dwc3_ep *dep) | |||
884 | return DWC3_TRB_NUM - 1; | 884 | return DWC3_TRB_NUM - 1; |
885 | } | 885 | } |
886 | 886 | ||
887 | trbs_left = dep->trb_dequeue - dep->trb_enqueue - 1; | 887 | trbs_left = dep->trb_dequeue - dep->trb_enqueue; |
888 | trbs_left &= (DWC3_TRB_NUM - 1); | 888 | trbs_left &= (DWC3_TRB_NUM - 1); |
889 | 889 | ||
890 | if (dep->trb_dequeue < dep->trb_enqueue) | ||
891 | trbs_left--; | ||
892 | |||
890 | return trbs_left; | 893 | return trbs_left; |
891 | } | 894 | } |
892 | 895 | ||