Skip to content

Commit

Permalink
Revert "usb: dwc3: gadget: always decrement by 1"
Browse files Browse the repository at this point in the history
This reverts commit 6f8245b ("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>
  • Loading branch information
John Youn authored and Felipe Balbi committed Sep 5, 2016
1 parent c693593 commit 9d7aba7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/usb/dwc3/gadget.c
Original file line number Diff line number Diff line change
Expand Up @@ -884,9 +884,12 @@ static u32 dwc3_calc_trbs_left(struct dwc3_ep *dep)
return DWC3_TRB_NUM - 1;
}

trbs_left = dep->trb_dequeue - dep->trb_enqueue - 1;
trbs_left = dep->trb_dequeue - dep->trb_enqueue;
trbs_left &= (DWC3_TRB_NUM - 1);

if (dep->trb_dequeue < dep->trb_enqueue)
trbs_left--;

return trbs_left;
}

Expand Down

0 comments on commit 9d7aba7

Please sign in to comment.