[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190702080126.178119054@linuxfoundation.org>
Date: Tue, 2 Jul 2019 10:01:30 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Fei Yang <fei.yang@...el.com>,
Sam Protsenko <semen.protsenko@...aro.org>,
Felipe Balbi <balbi@...nel.org>, linux-usb@...r.kernel.org,
Felipe Balbi <felipe.balbi@...ux.intel.com>,
John Stultz <john.stultz@...aro.org>,
Sasha Levin <sashal@...nel.org>
Subject: [PATCH 4.19 29/72] usb: dwc3: gadget: move requests to cancelled_list
commit d4f1afe5e896c18ae01099a85dab5e1a198bd2a8 upstream
Whenever we have a request in flight, we can move it to the cancelled
list and later simply iterate over that list and skip over any TRBs we
find.
Cc: Fei Yang <fei.yang@...el.com>
Cc: Sam Protsenko <semen.protsenko@...aro.org>
Cc: Felipe Balbi <balbi@...nel.org>
Cc: linux-usb@...r.kernel.org
Cc: stable@...r.kernel.org # 4.19.y
Signed-off-by: Felipe Balbi <felipe.balbi@...ux.intel.com>
(cherry picked from commit d4f1afe5e896c18ae01099a85dab5e1a198bd2a8)
Signed-off-by: John Stultz <john.stultz@...aro.org>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
drivers/usb/dwc3/gadget.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index c2169bc626c8..8291fa1624e1 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1364,6 +1364,17 @@ static void dwc3_gadget_ep_skip_trbs(struct dwc3_ep *dep, struct dwc3_request *r
}
}
+static void dwc3_gadget_ep_cleanup_cancelled_requests(struct dwc3_ep *dep)
+{
+ struct dwc3_request *req;
+ struct dwc3_request *tmp;
+
+ list_for_each_entry_safe(req, tmp, &dep->cancelled_list, list) {
+ dwc3_gadget_ep_skip_trbs(dep, req);
+ dwc3_gadget_giveback(dep, req, -ECONNRESET);
+ }
+}
+
static int dwc3_gadget_ep_dequeue(struct usb_ep *ep,
struct usb_request *request)
{
@@ -1400,8 +1411,9 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep,
if (!r->trb)
goto out0;
- dwc3_gadget_ep_skip_trbs(dep, r);
- goto out1;
+ dwc3_gadget_move_cancelled_request(req);
+ dwc3_gadget_ep_cleanup_cancelled_requests(dep);
+ goto out0;
}
dev_err(dwc->dev, "request %pK was not queued to %s\n",
request, ep->name);
@@ -1409,7 +1421,6 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep,
goto out0;
}
-out1:
dwc3_gadget_giveback(dep, req, -ECONNRESET);
out0:
--
2.20.1
Powered by blists - more mailing lists