diff options
author | Felipe Balbi <felipe.balbi@linux.intel.com> | 2018-04-06 15:37:30 +0300 |
---|---|---|
committer | Felipe Balbi <felipe.balbi@linux.intel.com> | 2018-05-21 10:00:56 +0300 |
commit | e0c42ce590fe331ab78368c6edc6cc8701e2aece (patch) | |
tree | 005e15638acf9821dee2baa86d2e40329b6089c7 /drivers/usb/dwc3 | |
parent | d80fe1b6e34d39ded5718f9433350c0d823c21d6 (diff) | |
download | linux-e0c42ce590fe331ab78368c6edc6cc8701e2aece.tar.xz |
usb: dwc3: gadget: simplify IOC handling
We will only have event status of IOC when IOC bit is set in
TRB. There's no need to check both bits.
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers/usb/dwc3')
-rw-r--r-- | drivers/usb/dwc3/gadget.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 752d615c959b..53fce66ee8fc 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2258,8 +2258,7 @@ static int dwc3_gadget_ep_reclaim_completed_trb(struct dwc3_ep *dep, if (event->status & DEPEVT_STATUS_SHORT && !chain) return 1; - if ((event->status & DEPEVT_STATUS_IOC) && - (trb->ctrl & DWC3_TRB_CTRL_IOC)) + if (event->status & DEPEVT_STATUS_IOC) return 1; return 0; @@ -2304,6 +2303,11 @@ static int dwc3_gadget_ep_reclaim_trb_linear(struct dwc3_ep *dep, event, status, false); } +static bool dwc3_gadget_ep_request_completed(struct dwc3_request *req) +{ + return req->request.actual == req->request.length; +} + static void dwc3_gadget_ep_cleanup_completed_requests(struct dwc3_ep *dep, const struct dwc3_event_depevt *event, int status) { @@ -2330,19 +2334,10 @@ static void dwc3_gadget_ep_cleanup_completed_requests(struct dwc3_ep *dep, req->request.actual = length - req->remaining; - if (req->request.actual < length || req->num_pending_sgs) { - /* - * There could be a scenario where the whole req can't - * be mapped into available TRB's. In that case, we need - * to kick transfer again if (req->num_pending_sgs > 0) - */ - if (req->num_pending_sgs) { - dev_WARN_ONCE(dep->dwc->dev, - (req->request.actual == length), - "There are some pending sg's that needs to be queued again\n"); - __dwc3_gadget_kick_transfer(dep); - return; - } + if (!dwc3_gadget_ep_request_completed(req) || + req->num_pending_sgs) { + __dwc3_gadget_kick_transfer(dep); + break; } dwc3_gadget_giveback(dep, req, status); |