Instead of relying on empty list of queued requests,
let's rely on the number of incomplete requests
actually in traffic.

Signed-off-by: Felipe Balbi <felipe.ba...@linux.intel.com>
---
 drivers/usb/dwc3/gadget.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 61e45319dfd0..491df30458e7 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -579,7 +579,7 @@ static void dwc3_remove_requests(struct dwc3 *dwc, struct 
dwc3_ep *dep)
 {
        struct dwc3_request             *req;
 
-       if (!list_empty(&dep->started_list)) {
+       if (dep->queued_requests) {
                dwc3_stop_active_transfer(dwc, dep->number, true);
 
                /* - giveback all requests to gadget driver */
@@ -1280,7 +1280,7 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int 
value, int protocol)
        memset(&params, 0x00, sizeof(params));
 
        if (value) {
-               if (!protocol && ((dep->direction && dep->flags & DWC3_EP_BUSY) 
||
+               if (!protocol && ((dep->direction && dep->queued_requests) ||
                                (!list_empty(&dep->started_list) ||
                                 !list_empty(&dep->pending_list)))) {
                        dwc3_trace(trace_dwc3_gadget,
-- 
2.8.3

---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki 
Business Identity Code: 0357606 - 4 
Domiciled in Helsinki 

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to