]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
usb: dwc3: gadget: when the started list is empty stop the active xfer
authorMichael Grzeschik <m.grzeschik@pengutronix.de>
Wed, 1 Jul 2020 18:24:53 +0000 (20:24 +0200)
committerFelipe Balbi <balbi@kernel.org>
Fri, 24 Jul 2020 13:45:15 +0000 (16:45 +0300)
When we have nothing left to be queued after handling the last trb
we have to stop the current transfer. This way we can ensure that
the next request will be queued with a new and valid timestamp
and will not directly run into an missed xfer.

Reviewed-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
drivers/usb/dwc3/gadget.c

index 779b173739294220ae0fd7cc2d8287207aa271c4..e44bfc3b5096d987dd74f9ff0c14a273862c6568 100644 (file)
@@ -2738,7 +2738,9 @@ static bool dwc3_gadget_endpoint_trbs_complete(struct dwc3_ep *dep,
        if (dep->flags & DWC3_EP_END_TRANSFER_PENDING)
                goto out;
 
-       if (status == -EXDEV && list_empty(&dep->started_list))
+       if (usb_endpoint_xfer_isoc(dep->endpoint.desc) &&
+               list_empty(&dep->started_list) &&
+               (list_empty(&dep->pending_list) || status == -EXDEV))
                dwc3_stop_active_transfer(dep, true, true);
        else if (dwc3_gadget_ep_should_continue(dep))
                if (__dwc3_gadget_kick_transfer(dep) == 0)