From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Prashanth K <quic_prashk@quicinc.com>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7] usb: common: usb-conn-gpio: Set last role to unknown before initial detection
Date: Thu, 15 Jun 2023 17:05:52 +0200 [thread overview]
Message-ID: <2023061556-hypnoses-quartet-766a@gregkh> (raw)
In-Reply-To: <551145bb-18f7-45af-b75e-7caccca113bc@quicinc.com>
On Thu, Jun 15, 2023 at 08:28:13PM +0530, Prashanth K wrote:
>
>
> On 15-06-23 08:06 pm, Greg Kroah-Hartman wrote:
> > On Thu, Jun 15, 2023 at 07:52:32PM +0530, Prashanth K wrote:
> > >
> > > In that case, can I resubmit v1 of this patch again, where I have used a
> > > macro in usb-conn-gpio driver ? something like this.
> > >
> > > @@ -27,6 +27,8 @@
> > > #define USB_CONN_IRQF \
> > > (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT)
> > >
> > > +#define USB_ROLE_UNKNOWN (USB_ROLE_NONE -1)
> >
> > Are you referencing an existing enum here and assuming it is a specific
> > value?
>
> I' not assuming UBS_ROLE_NONE to be a specific value, but I want an integer
> (for macro) which is not equal to USB_ROLE_NONE/DEVICE/HOST, that's why I'm
> using (USB_ROLE_NONE - 1), assuming enumerators NONE, DEVICE & HOST will be
> having adjacent integer values. Wouldn't that help?
You can't do "math" on an enumerated type and expect the result to be
anything constant over time.
And yes, you can hope that enumerated types are sequential, and the spec
says so, but please never rely on that as what happens if someone adds a
new one in the list without you ever noticing it.
Pleasae treat enumerated types as an opaque thing that you never know
the real value of, it's a symbol only.
thanks,
greg k-h
next prev parent reply other threads:[~2023-06-15 15:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-31 14:41 [PATCH v7] usb: common: usb-conn-gpio: Set last role to unknown before initial detection Prashanth K
2023-05-31 14:47 ` Prashanth K
2023-06-13 9:58 ` Greg Kroah-Hartman
2023-06-13 11:10 ` Heikki Krogerus
2023-06-14 4:25 ` Prashanth K
2023-06-14 8:36 ` Heikki Krogerus
2023-06-14 9:14 ` Heikki Krogerus
2023-06-15 9:30 ` Greg Kroah-Hartman
2023-06-15 14:22 ` Prashanth K
2023-06-15 14:36 ` Greg Kroah-Hartman
2023-06-15 14:58 ` Prashanth K
2023-06-15 15:05 ` Greg Kroah-Hartman [this message]
2023-06-15 18:11 ` Prashanth K
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=2023061556-hypnoses-quartet-766a@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=heikki.krogerus@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=quic_prashk@quicinc.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