Commit a9c3ca5f authored by Felipe Balbi's avatar Felipe Balbi

usb: dwc3: gadget: properly account queued requests

Some requests could be accounted for multiple
times. Let's fix that so each and every requests is
accounted for only once.

Cc: <stable@vger.kernel.org> # v4.8
Fixes: 55a0237f ("usb: dwc3: gadget: use allocated/queued reqs for LST bit")
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent 6c83f772
...@@ -783,6 +783,7 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep, ...@@ -783,6 +783,7 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
req->trb = trb; req->trb = trb;
req->trb_dma = dwc3_trb_dma_offset(dep, trb); req->trb_dma = dwc3_trb_dma_offset(dep, trb);
req->first_trb_index = dep->trb_enqueue; req->first_trb_index = dep->trb_enqueue;
dep->queued_requests++;
} }
dwc3_ep_inc_enq(dep); dwc3_ep_inc_enq(dep);
...@@ -833,8 +834,6 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep, ...@@ -833,8 +834,6 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
trb->ctrl |= DWC3_TRB_CTRL_HWO; trb->ctrl |= DWC3_TRB_CTRL_HWO;
dep->queued_requests++;
trace_dwc3_prepare_trb(dep, trb); trace_dwc3_prepare_trb(dep, trb);
} }
...@@ -1861,8 +1860,11 @@ static int __dwc3_cleanup_done_trbs(struct dwc3 *dwc, struct dwc3_ep *dep, ...@@ -1861,8 +1860,11 @@ static int __dwc3_cleanup_done_trbs(struct dwc3 *dwc, struct dwc3_ep *dep,
unsigned int s_pkt = 0; unsigned int s_pkt = 0;
unsigned int trb_status; unsigned int trb_status;
dep->queued_requests--;
dwc3_ep_inc_deq(dep); dwc3_ep_inc_deq(dep);
if (req->trb == trb)
dep->queued_requests--;
trace_dwc3_complete_trb(dep, trb); trace_dwc3_complete_trb(dep, trb);
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment