summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorThinh Nguyen <Thinh.Nguyen@synopsys.com>2020-10-01 02:44:38 +0200
committerFelipe Balbi <balbi@kernel.org>2020-10-02 08:57:46 +0200
commit2338484d14f3f4b3bd1f7bb416805976e7bd0cc5 (patch)
tree2177fe5f337f99efbab2a18076a836114f9c3639 /drivers
parentusb: dwc3: gadget: Keep TRBs in request order (diff)
downloadlinux-2338484d14f3f4b3bd1f7bb416805976e7bd0cc5.tar.xz
linux-2338484d14f3f4b3bd1f7bb416805976e7bd0cc5.zip
usb: dwc3: gadget: Return early if no TRB update
If the transfer had already started and there's no TRB to update, then there's no need to go through __dwc3_gadget_kick_transfer(). There is no problem reissuing UPDATE_TRANSFER command. This change just saves the driver from doing a few operations. This happens when we run out of TRB and function driver still queues for more requests. Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com> Signed-off-by: Felipe Balbi <balbi@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/dwc3/gadget.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index ff924656f690..da1f2ad2ad90 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1347,6 +1347,13 @@ static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep)
starting = !(dep->flags & DWC3_EP_TRANSFER_STARTED);
+ /*
+ * If there's no new TRB prepared and we don't need to restart a
+ * transfer, there's no need to update the transfer.
+ */
+ if (!ret && !starting)
+ return ret;
+
req = next_request(&dep->started_list);
if (!req) {
dep->flags |= DWC3_EP_PENDING_REQUEST;