diff options
author | Felipe Balbi <balbi@ti.com> | 2014-09-04 14:14:49 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2015-03-09 11:38:49 -0400 |
commit | 8f2c9544aba636134303105ecb164190a39dece4 (patch) | |
tree | fb595ad1844b23f48b6cd5dd938d19eff4a80f5f | |
parent | 3d0184d087573b7606de45a8e4f01b6222caa47a (diff) |
usb: dwc3: gadget: drop unnecessary loop when cleaning up TRBs
Now that we're using XFERINPROGRESS for all endpoint
types (except Control), we will *always* be completing
one TRB at a time, so it's safe to remove the loop
from dwc3_cleanup_done_reqs.
Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r-- | drivers/usb/dwc3/gadget.c | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index a03a485205c7..8946c32047e9 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
@@ -1855,32 +1855,27 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, struct dwc3_ep *dep, | |||
1855 | unsigned int i; | 1855 | unsigned int i; |
1856 | int ret; | 1856 | int ret; |
1857 | 1857 | ||
1858 | req = next_request(&dep->req_queued); | ||
1859 | if (!req) { | ||
1860 | WARN_ON_ONCE(1); | ||
1861 | return 1; | ||
1862 | } | ||
1863 | i = 0; | ||
1858 | do { | 1864 | do { |
1859 | req = next_request(&dep->req_queued); | 1865 | slot = req->start_slot + i; |
1860 | if (!req) { | 1866 | if ((slot == DWC3_TRB_NUM - 1) && |
1861 | WARN_ON_ONCE(1); | ||
1862 | return 1; | ||
1863 | } | ||
1864 | i = 0; | ||
1865 | do { | ||
1866 | slot = req->start_slot + i; | ||
1867 | if ((slot == DWC3_TRB_NUM - 1) && | ||
1868 | usb_endpoint_xfer_isoc(dep->endpoint.desc)) | 1867 | usb_endpoint_xfer_isoc(dep->endpoint.desc)) |
1869 | slot++; | 1868 | slot++; |
1870 | slot %= DWC3_TRB_NUM; | 1869 | slot %= DWC3_TRB_NUM; |
1871 | trb = &dep->trb_pool[slot]; | 1870 | trb = &dep->trb_pool[slot]; |
1872 | |||
1873 | ret = __dwc3_cleanup_done_trbs(dwc, dep, req, trb, | ||
1874 | event, status); | ||
1875 | if (ret) | ||
1876 | break; | ||
1877 | }while (++i < req->request.num_mapped_sgs); | ||
1878 | |||
1879 | dwc3_gadget_giveback(dep, req, status); | ||
1880 | 1871 | ||
1872 | ret = __dwc3_cleanup_done_trbs(dwc, dep, req, trb, | ||
1873 | event, status); | ||
1881 | if (ret) | 1874 | if (ret) |
1882 | break; | 1875 | break; |
1883 | } while (1); | 1876 | } while (++i < req->request.num_mapped_sgs); |
1877 | |||
1878 | dwc3_gadget_giveback(dep, req, status); | ||
1884 | 1879 | ||
1885 | if (usb_endpoint_xfer_isoc(dep->endpoint.desc) && | 1880 | if (usb_endpoint_xfer_isoc(dep->endpoint.desc) && |
1886 | list_empty(&dep->req_queued)) { | 1881 | list_empty(&dep->req_queued)) { |