From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: "Pandey, Radhey Shyam" <radhey.shyam.pandey@amd.com>
Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
Dan Scally <dan.scally@ideasonboard.com>,
Kuen-Han Tsai <khtsai@google.com>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"laurent.pinchart@ideasonboard.com"
<laurent.pinchart@ideasonboard.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"Simek, Michal" <michal.simek@amd.com>,
"Mehta, Piyush" <piyush.mehta@amd.com>,
"Paladugu,
Siva Durga Prasad" <siva.durga.prasad.paladugu@amd.com>
Subject: Re: [PATCH] usb: gadget: uvc_video: unlock before submitting a request to ep
Date: Fri, 19 Jan 2024 02:15:26 +0000 [thread overview]
Message-ID: <20240119021520.757vpt3oeig4hws2@synopsys.com> (raw)
In-Reply-To: <MN0PR12MB59538FF4FF9C753EB9264E21B7692@MN0PR12MB5953.namprd12.prod.outlook.com>
Hi,
On Wed, Jan 10, 2024, Pandey, Radhey Shyam wrote:
>
> Thanks, Thinh. I came across this thread and wanted to check if you
> have some fix ready?
Would you mind test this change to see if it fixes the issue:
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 8d1881adcd80..f40c7b9105cc 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1808,6 +1808,7 @@ static int dwc3_prepare_trbs(struct dwc3_ep *dep)
return ret;
}
+static void dwc3_gadget_ep_skip_trbs(struct dwc3_ep *dep, struct dwc3_request *req);
static void dwc3_gadget_ep_cleanup_cancelled_requests(struct dwc3_ep *dep);
static void dwc3_gadget_restore_requests(struct dwc3_ep *dep);
@@ -1874,9 +1875,27 @@ static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep)
list_for_each_entry_safe(req, tmp, &dep->started_list, list)
dwc3_gadget_move_cancelled_request(req, DWC3_REQUEST_STATUS_DEQUEUED);
- /* If ep isn't started, then there's no end transfer pending */
- if (!(dep->flags & DWC3_EP_END_TRANSFER_PENDING))
- dwc3_gadget_ep_cleanup_cancelled_requests(dep);
+ if ((dep->flags & DWC3_EP_DELAY_START) ||
+ (dep->flags & DWC3_EP_WAIT_TRANSFER_COMPLETE) ||
+ (dep->flags & DWC3_EP_TRANSFER_STARTED)) {
+ /* If ep isn't started, then there's no end transfer pending */
+ if (!(dep->flags & DWC3_EP_END_TRANSFER_PENDING))
+ dwc3_gadget_ep_cleanup_cancelled_requests(dep);
+ } else {
+ /*
+ * To be in this condition means usb_ep_queue() isn't
+ * completed yet. Since the controller hasn't owned the
+ * requests yet, don't give back the requests on failed
+ * usb_ep_queue. Simply remove them from the endpoint's
+ * list.
+ */
+ while (!list_empty(&dep->cancelled_list)) {
+ req = next_request(&dep->cancelled_list);
+ dwc3_gadget_ep_skip_trbs(dep, req);
+ dwc3_gadget_del_and_unmap_request(dep, req, -EINPROGRESS);
+ req->status = DWC3_REQUEST_STATUS_COMPLETED;
+ }
+ }
return ret;
}
BTW, what was the error code returned from usb_ep_queue()? Is it
-ETIMEDOUT?
Thanks,
Thinh
next prev parent reply other threads:[~2024-01-19 2:15 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-02 7:11 Piyush Mehta
2023-11-02 9:05 ` Sergey Shtylyov
2023-11-02 12:00 ` Dan Scally
2023-11-08 11:48 ` Kuen-Han Tsai
2023-11-08 14:19 ` Dan Scally
2023-11-16 9:28 ` Dan Scally
2023-11-17 1:45 ` Thinh Nguyen
2023-11-17 3:28 ` Thinh Nguyen
2024-01-10 9:14 ` Pandey, Radhey Shyam
2024-01-11 1:21 ` Thinh Nguyen
2024-01-19 2:15 ` Thinh Nguyen [this message]
2024-01-29 10:08 ` Pandey, Radhey Shyam
2024-05-14 7:04 ` Pandey, Radhey Shyam
2024-05-17 2:42 ` Kuen-Han Tsai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240119021520.757vpt3oeig4hws2@synopsys.com \
--to=thinh.nguyen@synopsys.com \
--cc=dan.scally@ideasonboard.com \
--cc=gregkh@linuxfoundation.org \
--cc=khtsai@google.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=michal.simek@amd.com \
--cc=piyush.mehta@amd.com \
--cc=radhey.shyam.pandey@amd.com \
--cc=siva.durga.prasad.paladugu@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®