All of lore.kernel.org
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] usb: dwc3: gadget: properly account queued requests" failed to apply to 4.8-stable tree
@ 2016-11-07 16:49 gregkh
  2016-11-09 11:19 ` [PATCH] usb: dwc3: gadget: properly account queued requests Felipe Balbi
  0 siblings, 1 reply; 3+ messages in thread
From: gregkh @ 2016-11-07 16:49 UTC (permalink / raw)
  To: felipe.balbi, stable; +Cc: stable


The patch below does not apply to the 4.8-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

>From a9c3ca5fae6bf73770f0576eaf57d5f1305ef4b3 Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.balbi@linux.intel.com>
Date: Wed, 5 Oct 2016 14:24:37 +0300
Subject: [PATCH] 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>

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,
 		req->trb = trb;
 		req->trb_dma = dwc3_trb_dma_offset(dep, trb);
 		req->first_trb_index = dep->trb_enqueue;
+		dep->queued_requests++;
 	}
 
 	dwc3_ep_inc_enq(dep);
@@ -833,8 +834,6 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
 
 	trb->ctrl |= DWC3_TRB_CTRL_HWO;
 
-	dep->queued_requests++;
-
 	trace_dwc3_prepare_trb(dep, trb);
 }
 
@@ -1861,8 +1860,11 @@ static int __dwc3_cleanup_done_trbs(struct dwc3 *dwc, struct dwc3_ep *dep,
 	unsigned int		s_pkt = 0;
 	unsigned int		trb_status;
 
-	dep->queued_requests--;
 	dwc3_ep_inc_deq(dep);
+
+	if (req->trb == trb)
+		dep->queued_requests--;
+
 	trace_dwc3_complete_trb(dep, trb);
 
 	/*


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] usb: dwc3: gadget: properly account queued requests
  2016-11-07 16:49 FAILED: patch "[PATCH] usb: dwc3: gadget: properly account queued requests" failed to apply to 4.8-stable tree gregkh
@ 2016-11-09 11:19 ` Felipe Balbi
  2016-11-13 11:19   ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Felipe Balbi @ 2016-11-09 11:19 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: stable, Felipe Balbi

commit a9c3ca5fae6bf73770f0576eaf57d5f1305ef4b3 upstream.

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>
---
 drivers/usb/dwc3/gadget.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 68544618982e..fc2e7d3e8d28 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -789,6 +789,7 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
 		req->trb = trb;
 		req->trb_dma = dwc3_trb_dma_offset(dep, trb);
 		req->first_trb_index = dep->trb_enqueue;
+		dep->queued_requests++;
 	}
 
 	dwc3_ep_inc_enq(dep);
@@ -841,8 +842,6 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
 
 	trb->ctrl |= DWC3_TRB_CTRL_HWO;
 
-	dep->queued_requests++;
-
 	trace_dwc3_prepare_trb(dep, trb);
 }
 
@@ -1963,7 +1962,9 @@ static int __dwc3_cleanup_done_trbs(struct dwc3 *dwc, struct dwc3_ep *dep,
 	unsigned int		s_pkt = 0;
 	unsigned int		trb_status;
 
-	dep->queued_requests--;
+	if (req->trb == trb)
+		dep->queued_requests--;
+
 	trace_dwc3_complete_trb(dep, trb);
 
 	/*
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] usb: dwc3: gadget: properly account queued requests
  2016-11-09 11:19 ` [PATCH] usb: dwc3: gadget: properly account queued requests Felipe Balbi
@ 2016-11-13 11:19   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2016-11-13 11:19 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: stable

On Wed, Nov 09, 2016 at 01:19:19PM +0200, Felipe Balbi wrote:
> commit a9c3ca5fae6bf73770f0576eaf57d5f1305ef4b3 upstream.
> 
> 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>
> ---
>  drivers/usb/dwc3/gadget.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)

Thanks, now queued up.

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-13 11:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-07 16:49 FAILED: patch "[PATCH] usb: dwc3: gadget: properly account queued requests" failed to apply to 4.8-stable tree gregkh
2016-11-09 11:19 ` [PATCH] usb: dwc3: gadget: properly account queued requests Felipe Balbi
2016-11-13 11:19   ` Greg Kroah-Hartman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.