From: Alan Stern <stern@rowland.harvard.edu>
To: "Bjørn Mork" <bjorn@mork.no>
Cc: Xu Yang <xu.yang_2@nxp.com>,
gregkh@linuxfoundation.org, khtsai@google.com,
kexinsun@smail.nju.edu.cn, hhhuuu@google.com, kees@kernel.org,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
imx@lists.linux.dev, jun.li@nxp.com
Subject: Re: [PATCH] usb: gadget: udc: skip pullup() if already connected
Date: Tue, 21 Apr 2026 16:18:07 -0400 [thread overview]
Message-ID: <40ab2813-e583-484e-990b-1a3651e0bbb4@rowland.harvard.edu> (raw)
In-Reply-To: <87v7dkpc4b.fsf@miraculix.mork.no>
On Tue, Apr 21, 2026 at 05:27:32PM +0200, Bjørn Mork wrote:
> Alan Stern <stern@rowland.harvard.edu> writes:
>
> > This patch is wrong. To see why, read the comments just below the end
> > of the patch and see also usb_gadget_activate().
>
>
> Made me look...
>
> Must say. This strikes me as a nice way to filter out humans from the
> rest of the submitters:
>
> gadget->connected = true;
> goto out;
> }
>
> ret = gadget->ops->pullup(gadget, 1);
> if (!ret)
> gadget->connected = 1;
>
>
> The indecisiveness looks strange. There's a nice symmetry with
> usb_gadget_disconnect_locked() though:
>
> gadget->connected = false;
> goto out;
> }
>
> ret = gadget->ops->pullup(gadget, 0);
> if (!ret)
> gadget->connected = 0;
Granted, it does look a little strange. ->connected is actually a 1-bit
bitfield, though, so treating it as a boolean instead of an integer is
not completely beyond the bounds of reason.
> What surprised me most was that the different variants were added by the
> same commit
> ccdf138fe3e2 ("usb: gadget: add usb_gadget_activate/deactivate functions").
But this isn't what my rejection was complaining about. The patch's
problem was functional, not aesthetic.
Alan Stern
next prev parent reply other threads:[~2026-04-21 20:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-21 8:20 Xu Yang
2026-04-21 14:37 ` Alan Stern
2026-04-21 15:27 ` Bjørn Mork
2026-04-21 20:18 ` Alan Stern [this message]
2026-04-22 11:31 ` Xu Yang
2026-04-22 14:24 ` Alan Stern
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=40ab2813-e583-484e-990b-1a3651e0bbb4@rowland.harvard.edu \
--to=stern@rowland.harvard.edu \
--cc=bjorn@mork.no \
--cc=gregkh@linuxfoundation.org \
--cc=hhhuuu@google.com \
--cc=imx@lists.linux.dev \
--cc=jun.li@nxp.com \
--cc=kees@kernel.org \
--cc=kexinsun@smail.nju.edu.cn \
--cc=khtsai@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=xu.yang_2@nxp.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®