[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1644831438-125403-2-git-send-email-dh10.jung@samsung.com>
Date: Mon, 14 Feb 2022 18:37:17 +0900
From: Daehwan Jung <dh10.jung@...sung.com>
To: Felipe Balbi <balbi@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org (open list),
Daehwan Jung <dh10.jung@...sung.com>, quic_wcheng@...cinc.com,
quic_jackp@...cinc.com, Thinh.Nguyen@...opsys.com
Subject: [PATCH v1 1/2] usb: dwc3: Not set DWC3_EP_END_TRANSFER_PENDING in
ep cmd fails
It always sets DWC3_EP_END_TRANSFER_PENDING in dwc3_stop_active_transfer
even if dwc3_send_gadget_ep_cmd fails. It can cause some problems like
skipping clear stall commmand or giveback from dequeue. We fix to set it
only when ep cmd success. Additionally, We clear DWC3_EP_TRANSFER_STARTED
for next trb to start transfer not update transfer.
Change-Id: I2e6b58acc99f385e467e8b639a3792a5e5f4d2bb
Signed-off-by: Daehwan Jung <dh10.jung@...sung.com>
---
drivers/usb/dwc3/gadget.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 183b90923f51..3ad3bc5813ca 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -2044,6 +2044,12 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep,
dwc3_gadget_move_cancelled_request(r,
DWC3_REQUEST_STATUS_DEQUEUED);
+ /* If ep cmd fails, then force to giveback cancelled requests here */
+ if (!(dep->flags & DWC3_EP_END_TRANSFER_PENDING)) {
+ dep->flags &= ~DWC3_EP_TRANSFER_STARTED;
+ dwc3_gadget_ep_cleanup_cancelled_requests(dep);
+ }
+
dep->flags &= ~DWC3_EP_WAIT_TRANSFER_COMPLETE;
goto out;
@@ -3645,7 +3651,7 @@ static void dwc3_stop_active_transfer(struct dwc3_ep *dep, bool force,
if (!interrupt)
dep->flags &= ~DWC3_EP_TRANSFER_STARTED;
- else
+ else if (!ret)
dep->flags |= DWC3_EP_END_TRANSFER_PENDING;
}
--
2.31.1
Powered by blists - more mailing lists