* [PATCH] usb: gadget: u_serial: Dequeue the console request only when queued
@ 2026-09-28 18:18 ` Fabricio Akio via B4 Relay
0 siblings, 0 replies; 3+ messages in thread
From: Fabricio Akio @ 2026-09-28 18:18 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-usb, linux-kernel, Fabricio Akio
gs_console_disconnect() dequeues the console request even when it is
idle, which dwc3 reports as "request ... was not queued" on every
disconnect. Dequeue it only while req->length marks it as queued.
Signed-off-by: Fabricio Akio <fabricioakio@gmail.com>
---
Tested on a Motorola Moto X4 (XT1900-6, SDM630) with the sdm660-mainline
7.2.3 tree and the gadget serial console in use: "request ... was not
queued to ep3in" is logged on every system suspend without this patch,
and not over three consecutive cycles with it. The path where the
request is still queued at disconnect was not exercised. Applies
unchanged to next-20260928.
---
drivers/usb/gadget/function/u_serial.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c
index cdd1dfc666c4..53a56ddec08a 100644
--- a/drivers/usb/gadget/function/u_serial.c
+++ b/drivers/usb/gadget/function/u_serial.c
@@ -1055,6 +1055,7 @@ static void gs_console_disconnect(struct gs_port *port)
struct gs_console *cons = port->console;
struct usb_request *req;
struct usb_ep *ep;
+ bool was_queued;
if (!cons)
return;
@@ -1063,6 +1064,8 @@ static void gs_console_disconnect(struct gs_port *port)
req = cons->req;
ep = cons->console.data;
+ /* A non-zero length marks the request as queued. */
+ was_queued = req && req->length;
cons->req = NULL;
spin_unlock(&cons->lock);
@@ -1070,7 +1073,8 @@ static void gs_console_disconnect(struct gs_port *port)
if (!req)
return;
- usb_ep_dequeue(ep, req);
+ if (was_queued)
+ usb_ep_dequeue(ep, req);
gs_free_req(ep, req);
}
---
base-commit: 6375e61c01e93e35ee7acd336a689ac1fae4b509
change-id: 20260928-u-serial-console-dequeue-f9790a8e87c6
Best regards,
--
Fabricio Akio <fabricioakio@gmail.com>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] usb: gadget: u_serial: Dequeue the console request only when queued
@ 2026-09-28 18:18 ` Fabricio Akio via B4 Relay
0 siblings, 0 replies; 3+ messages in thread
From: Fabricio Akio via B4 Relay @ 2026-09-28 18:18 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-usb, linux-kernel, Fabricio Akio
From: Fabricio Akio <fabricioakio@gmail.com>
gs_console_disconnect() dequeues the console request even when it is
idle, which dwc3 reports as "request ... was not queued" on every
disconnect. Dequeue it only while req->length marks it as queued.
Signed-off-by: Fabricio Akio <fabricioakio@gmail.com>
---
Tested on a Motorola Moto X4 (XT1900-6, SDM630) with the sdm660-mainline
7.2.3 tree and the gadget serial console in use: "request ... was not
queued to ep3in" is logged on every system suspend without this patch,
and not over three consecutive cycles with it. The path where the
request is still queued at disconnect was not exercised. Applies
unchanged to next-20260928.
---
drivers/usb/gadget/function/u_serial.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c
index cdd1dfc666c4..53a56ddec08a 100644
--- a/drivers/usb/gadget/function/u_serial.c
+++ b/drivers/usb/gadget/function/u_serial.c
@@ -1055,6 +1055,7 @@ static void gs_console_disconnect(struct gs_port *port)
struct gs_console *cons = port->console;
struct usb_request *req;
struct usb_ep *ep;
+ bool was_queued;
if (!cons)
return;
@@ -1063,6 +1064,8 @@ static void gs_console_disconnect(struct gs_port *port)
req = cons->req;
ep = cons->console.data;
+ /* A non-zero length marks the request as queued. */
+ was_queued = req && req->length;
cons->req = NULL;
spin_unlock(&cons->lock);
@@ -1070,7 +1073,8 @@ static void gs_console_disconnect(struct gs_port *port)
if (!req)
return;
- usb_ep_dequeue(ep, req);
+ if (was_queued)
+ usb_ep_dequeue(ep, req);
gs_free_req(ep, req);
}
---
base-commit: 6375e61c01e93e35ee7acd336a689ac1fae4b509
change-id: 20260928-u-serial-console-dequeue-f9790a8e87c6
Best regards,
--
Fabricio Akio <fabricioakio@gmail.com>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] usb: gadget: u_serial: Dequeue the console request only when queued
2026-09-28 18:18 ` Fabricio Akio via B4 Relay
(?)
@ 2026-11-20 13:56 ` Greg Kroah-Hartman
-1 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-20 13:56 UTC (permalink / raw)
To: fabricioakio; +Cc: linux-usb, linux-kernel
On Mon, Sep 28, 2026 at 03:18:18PM -0300, Fabricio Akio via B4 Relay wrote:
> From: Fabricio Akio <fabricioakio@gmail.com>
>
> gs_console_disconnect() dequeues the console request even when it is
> idle, which dwc3 reports as "request ... was not queued" on every
> disconnect. Dequeue it only while req->length marks it as queued.
>
> Signed-off-by: Fabricio Akio <fabricioakio@gmail.com>
> ---
> Tested on a Motorola Moto X4 (XT1900-6, SDM630) with the sdm660-mainline
> 7.2.3 tree and the gadget serial console in use: "request ... was not
> queued to ep3in" is logged on every system suspend without this patch,
> and not over three consecutive cycles with it. The path where the
> request is still queued at disconnect was not exercised. Applies
> unchanged to next-20260928.
> ---
> drivers/usb/gadget/function/u_serial.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
Please address the issues found here:
https://sashiko.dev/#/patchset/20260928-u-serial-console-dequeue-v1-1-b44d68585632@gmail.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-20 13:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-28 18:18 [PATCH] usb: gadget: u_serial: Dequeue the console request only when queued Fabricio Akio
2026-09-28 18:18 ` Fabricio Akio via B4 Relay
2026-11-20 13:56 ` Greg Kroah-Hartman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.