From: Sebastian Andrzej Siewior Date: Mon, 22 Aug 2011 15:42:18 +0000 (+0200) Subject: usb: dwc3: gadget: reset resource index to zero X-Git-Tag: MMI-PSA29.97-13-9~18248^2~148^2~45 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a1ae9be5fc137d7e911a77ef408273ff55a53a39;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git usb: dwc3: gadget: reset resource index to zero If we collected two requests together (i.e. only the last of them has LST=1) then we only have to stop transfer once: The clean-up code will cleanup everything until first TRB with the LST bit set. After XferComplete this index should be no longer valid since there is no transfer pending. Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Felipe Balbi --- diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 56f0e46c00ad..a324957c38f0 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1366,8 +1366,10 @@ static void dwc3_endpoint_transfer_complete(struct dwc3 *dwc, status = -ECONNRESET; clean_busy = dwc3_cleanup_done_reqs(dwc, dep, event, status); - if (clean_busy) + if (clean_busy) { dep->flags &= ~DWC3_EP_BUSY; + dep->res_trans_idx = 0; + } } static void dwc3_gadget_start_isoc(struct dwc3 *dwc, @@ -1537,6 +1539,7 @@ static void dwc3_stop_active_transfer(struct dwc3 *dwc, u32 epnum) memset(¶ms, 0, sizeof(params)); ret = dwc3_send_gadget_ep_cmd(dwc, dep->number, cmd, ¶ms); WARN_ON_ONCE(ret); + dep->res_trans_idx = 0; } }