All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiazi Liu <jiazi.liu1984@gmail.com>
To: Thinh.Nguyen@synopsys.com
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org, Jiazi Liu <liujiazi@amazon.com>
Subject: [PATCH 1/1] usb: dwc3: ep0: skip CLEAR_HALT on non-stalled endpoints
Date: Mon, 27 Jul 2026 17:58:27 +0800	[thread overview]
Message-ID: <20260727095827.11807-1-liujiazi@amazon.com> (raw)

Mac hosts send CLEAR_FEATURE(HALT) to all endpoints immediately after
SET_CONFIGURATION, even when no endpoint is actually stalled. This
causes __dwc3_gadget_ep_set_halt() to be called unnecessarily, which
can disrupt ongoing transfers on active endpoints.

Fix this by checking the DWC3_EP_STALL flag before processing
CLEAR_FEATURE(HALT). If the endpoint is not stalled, simply acknowledge
the host request without calling into the endpoint halt path.

Signed-off-by: Jiazi Liu <liujiazi@amazon.com>
---
 drivers/usb/dwc3/ep0.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index bfe616194dfa..b577a1b764fc 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -554,6 +554,9 @@ static int dwc3_ep0_handle_endpoint(struct dwc3 *dwc,
 		if (set == 0 && (dep->flags & DWC3_EP_WEDGE))
 			break;
 
+		if (set == 0 && !(dep->flags & DWC3_EP_STALL))
+			break;
+
 		ret = __dwc3_gadget_ep_set_halt(dep, set, true);
 		if (ret)
 			return -EINVAL;
-- 
2.50.1 (Apple Git-155)


             reply	other threads:[~2026-07-27  9:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-27  9:58 Jiazi Liu [this message]
2026-08-04 23:17 ` [PATCH 1/1] usb: dwc3: ep0: skip CLEAR_HALT on non-stalled endpoints Thinh Nguyen

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=20260727095827.11807-1-liujiazi@amazon.com \
    --to=jiazi.liu1984@gmail.com \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=liujiazi@amazon.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 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.