* [7/8] usb: dwc3: gadget: move requests to cancelled_list
@ 2018-11-05 7:11 Felipe Balbi
0 siblings, 0 replies; only message in thread
From: Felipe Balbi @ 2018-11-05 7:11 UTC (permalink / raw)
To: Linux USB; +Cc: Laurent Pinchart, Felipe Balbi
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.
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
---
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 4cc0509d74ff..cfe99009210f 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1360,6 +1360,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)
{
@@ -1396,8 +1407,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);
@@ -1405,7 +1417,6 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep,
goto out0;
}
-out1:
dwc3_gadget_giveback(dep, req, -ECONNRESET);
out0:
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2018-11-05 7:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-05 7:11 [7/8] usb: dwc3: gadget: move requests to cancelled_list Felipe Balbi
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.