diff options
author | Felipe Balbi <felipe.balbi@linux.intel.com> | 2016-10-05 07:24:37 -0400 |
---|---|---|
committer | Felipe Balbi <felipe.balbi@linux.intel.com> | 2016-10-17 04:14:00 -0400 |
commit | a9c3ca5fae6bf73770f0576eaf57d5f1305ef4b3 (patch) | |
tree | a5da8e4ebb108764f8b8838ce4cedf9b19f86d7b | |
parent | 6c83f77278f17a7679001027e9231291c20f0d8a (diff) |
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: 55a0237f8f47 ("usb: dwc3: gadget: use allocated/queued reqs for LST bit")
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
-rw-r--r-- | drivers/usb/dwc3/gadget.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 07cc8929f271..3c3ced128c77 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
@@ -783,6 +783,7 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep, | |||
783 | req->trb = trb; | 783 | req->trb = trb; |
784 | req->trb_dma = dwc3_trb_dma_offset(dep, trb); | 784 | req->trb_dma = dwc3_trb_dma_offset(dep, trb); |
785 | req->first_trb_index = dep->trb_enqueue; | 785 | req->first_trb_index = dep->trb_enqueue; |
786 | dep->queued_requests++; | ||
786 | } | 787 | } |
787 | 788 | ||
788 | dwc3_ep_inc_enq(dep); | 789 | dwc3_ep_inc_enq(dep); |
@@ -833,8 +834,6 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep, | |||
833 | 834 | ||
834 | trb->ctrl |= DWC3_TRB_CTRL_HWO; | 835 | trb->ctrl |= DWC3_TRB_CTRL_HWO; |
835 | 836 | ||
836 | dep->queued_requests++; | ||
837 | |||
838 | trace_dwc3_prepare_trb(dep, trb); | 837 | trace_dwc3_prepare_trb(dep, trb); |
839 | } | 838 | } |
840 | 839 | ||
@@ -1861,8 +1860,11 @@ static int __dwc3_cleanup_done_trbs(struct dwc3 *dwc, struct dwc3_ep *dep, | |||
1861 | unsigned int s_pkt = 0; | 1860 | unsigned int s_pkt = 0; |
1862 | unsigned int trb_status; | 1861 | unsigned int trb_status; |
1863 | 1862 | ||
1864 | dep->queued_requests--; | ||
1865 | dwc3_ep_inc_deq(dep); | 1863 | dwc3_ep_inc_deq(dep); |
1864 | |||
1865 | if (req->trb == trb) | ||
1866 | dep->queued_requests--; | ||
1867 | |||
1866 | trace_dwc3_complete_trb(dep, trb); | 1868 | trace_dwc3_complete_trb(dep, trb); |
1867 | 1869 | ||
1868 | /* | 1870 | /* |