diff options
author | Felipe Balbi <felipe.balbi@linux.intel.com> | 2016-08-11 12:26:59 +0300 |
---|---|---|
committer | Felipe Balbi <felipe.balbi@linux.intel.com> | 2016-08-22 10:45:37 +0300 |
commit | 45438a0cd9c2b80917047b77fab1ff46cf710748 (patch) | |
tree | de255789b4e139a4c8f93b5e64181f012c7505b9 /drivers | |
parent | 737f1ae2556a5d219c24fbea2e1c63b7d9e10869 (diff) |
usb: dwc3: gadget: simplify dwc3_ep_prev_trb()
We always need to decrement our index by at least
one. Simplify the implementation by using a
temporary local variable and making sure that we
will always decrement one extra if tmp == 0.
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/dwc3/gadget.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 18045997b593..a310266abc20 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -845,12 +845,12 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep, */ static struct dwc3_trb *dwc3_ep_prev_trb(struct dwc3_ep *dep, u8 index) { - if (!index) - index = DWC3_TRB_NUM - 2; - else - index = dep->trb_enqueue - 1; + u8 tmp = index; + + if (!tmp) + tmp = DWC3_TRB_NUM - 1; - return &dep->trb_pool[index]; + return &dep->trb_pool[tmp - 1]; } static u32 dwc3_calc_trbs_left(struct dwc3_ep *dep) |