diff mbox

[3/5] usb: dwc3: gadget: clear DWC3_PENDING_REQUEST when request is queued

Message ID 1442339542-17090-4-git-send-email-balbi@ti.com
State New
Headers show

Commit Message

Felipe Balbi Sept. 15, 2015, 5:52 p.m. UTC
Instead of clearing DWC3_PENDING_REQUEST when
we start transfer, let's do it when the request
is actually queued, that way we know for sure
that we're clearing in the right time.

Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 drivers/usb/dwc3/gadget.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index a0d3a4e762c5..8ef6c57ab918 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -948,7 +948,6 @@  static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep, u16 cmd_param,
 		dwc3_trace(trace_dwc3_gadget, "%s: endpoint busy", dep->name);
 		return -EBUSY;
 	}
-	dep->flags &= ~DWC3_EP_PENDING_REQUEST;
 
 	cmd = DWC3_DEPCMD_UPDATETRANSFER |
 		DWC3_DEPCMD_PARAM(cmd_param);
@@ -1108,6 +1107,10 @@  static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
 		if (ret && ret != -EBUSY)
 			dev_dbg(dwc->dev, "%s: failed to kick transfers\n",
 					dep->name);
+
+		if (!ret)
+			dep->flags &= ~DWC3_EP_PENDING_REQUEST;
+
 		return ret;
 	}