diff options
author | Felipe Balbi <felipe.balbi@linux.intel.com> | 2016-06-21 10:32:02 +0300 |
---|---|---|
committer | Felipe Balbi <felipe.balbi@linux.intel.com> | 2016-06-21 10:38:44 +0300 |
commit | 0e146028eebf989e86d3fe9385b76434e954c84e (patch) | |
tree | 7df417e9250bd4990de6d3a3357ba8b0b975834a /drivers/usb | |
parent | 328082376aea6016b63bca1e5c067a9539f9e8c9 (diff) | |
download | linux-0e146028eebf989e86d3fe9385b76434e954c84e.tar.gz linux-0e146028eebf989e86d3fe9385b76434e954c84e.tar.bz2 linux-0e146028eebf989e86d3fe9385b76434e954c84e.zip |
usb: dwc3: gadget: issue ENDTRANSFER conditional on resource_index
Because of recent changes to transfer handling on
DWC3, we will not get XferComplete unless we
completely fill up our TRB ring. This means that we
might get a Reset or Disconnect without getting a
XferComplete first.
In order to correctly release our allocated Transfer
Resource, we must issue ENDTRANSFER command whenever
dep->resource_index is valid.
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/dwc3/gadget.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 0afaa9d58562..b1fec36f4764 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -607,24 +607,14 @@ static void dwc3_stop_active_transfer(struct dwc3 *dwc, u32 epnum, bool force); static void dwc3_remove_requests(struct dwc3 *dwc, struct dwc3_ep *dep) { struct dwc3_request *req; - struct dwc3_trb *current_trb; - unsigned transfer_in_flight; - if (dep->number > 1) - current_trb = &dep->trb_pool[dep->trb_enqueue]; - else - current_trb = &dwc->ep0_trb[dep->trb_enqueue]; - transfer_in_flight = current_trb->ctrl & DWC3_TRB_CTRL_HWO; - - if (transfer_in_flight && !list_empty(&dep->started_list)) { - dwc3_stop_active_transfer(dwc, dep->number, true); + dwc3_stop_active_transfer(dwc, dep->number, true); - /* - giveback all requests to gadget driver */ - while (!list_empty(&dep->started_list)) { - req = next_request(&dep->started_list); + /* - giveback all requests to gadget driver */ + while (!list_empty(&dep->started_list)) { + req = next_request(&dep->started_list); - dwc3_gadget_giveback(dep, req, -ESHUTDOWN); - } + dwc3_gadget_giveback(dep, req, -ESHUTDOWN); } while (!list_empty(&dep->pending_list)) { |