diff options
author | Thinh Nguyen <Thinh.Nguyen@synopsys.com> | 2020-03-05 13:24:20 -0800 |
---|---|---|
committer | Felipe Balbi <balbi@kernel.org> | 2020-05-05 10:58:53 +0300 |
commit | fcd2def6639293c2bde2dc4f5dab63641a60b5b3 (patch) | |
tree | c4a085dd0f6cdb2bae6c6b6dc9a4f77b8eb8dba8 /drivers | |
parent | 8411993e79df8e54da67613025d620a8a23a24fe (diff) | |
download | linux-fcd2def6639293c2bde2dc4f5dab63641a60b5b3.tar.bz2 |
usb: dwc3: gadget: Refactor dwc3_gadget_ep_dequeue
The flow from function dwc3_gadget_ep_dequeue() is not easy to follow.
Refactor it for easier read. No functional change in this commit.
Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/dwc3/gadget.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 2b58f0e595a2..58a05c59ab3f 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1562,19 +1562,17 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep, list_for_each_entry(r, &dep->cancelled_list, list) { if (r == req) - goto out0; + goto out; } list_for_each_entry(r, &dep->pending_list, list) { - if (r == req) - break; + if (r == req) { + dwc3_gadget_giveback(dep, req, -ECONNRESET); + goto out; + } } - if (r != req) { - list_for_each_entry(r, &dep->started_list, list) { - if (r == req) - break; - } + list_for_each_entry(r, &dep->started_list, list) { if (r == req) { struct dwc3_request *t; @@ -1588,17 +1586,14 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep, list_for_each_entry_safe(r, t, &dep->started_list, list) dwc3_gadget_move_cancelled_request(r); - goto out0; + goto out; } - dev_err(dwc->dev, "request %pK was not queued to %s\n", - request, ep->name); - ret = -EINVAL; - goto out0; } - dwc3_gadget_giveback(dep, req, -ECONNRESET); - -out0: + dev_err(dwc->dev, "request %pK was not queued to %s\n", + request, ep->name); + ret = -EINVAL; +out: spin_unlock_irqrestore(&dwc->lock, flags); return ret; |