summaryrefslogtreecommitdiff
path: root/drivers/usb/dwc3
diff options
context:
space:
mode:
authorFelipe Balbi <felipe.balbi@linux.intel.com>2018-08-01 13:54:25 +0300
committerFelipe Balbi <felipe.balbi@linux.intel.com>2018-11-26 10:08:29 +0300
commitd4f1afe5e896c18ae01099a85dab5e1a198bd2a8 (patch)
treef9808fcda8bea3c75fba970afb32b28520001ffc /drivers/usb/dwc3
parentd5443bbf5fc8f8389cce146b1fc2987cdd229d12 (diff)
downloadlinux-d4f1afe5e896c18ae01099a85dab5e1a198bd2a8.tar.xz
usb: dwc3: gadget: move requests to cancelled_list
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>
Diffstat (limited to 'drivers/usb/dwc3')
-rw-r--r--drivers/usb/dwc3/gadget.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 17203944d77f..d5b9db90ca1c 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1498,6 +1498,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)
{
@@ -1534,8 +1545,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);
@@ -1543,7 +1555,6 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep,
goto out0;
}
-out1:
dwc3_gadget_giveback(dep, req, -ECONNRESET);
out0: