Re: [PATCH] PNP: make pnp_eisa_id_to_string() take __be32 id
From: Rafael J. Wysocki
Date: Wed Jun 24 2026 - 09:15:03 EST
On Tue, Jun 23, 2026 at 4:50 PM Rafael J. Wysocki <rafael@xxxxxxxxxx> wrote:
>
> On Wed, Jun 17, 2026 at 3:55 PM Ben Dooks <ben.dooks@xxxxxxxxxxxxxxx> wrote:
> >
> > The pnp_eisa_id_to_string() should take a __be32 id as it
> > passes it immediately to be32_to_cpu(). Change the type
> > of this to fix the following sparse warning:
> >
> > drivers/pnp/support.c:42:14: warning: cast to restricted __be32
> >
> > Signed-off-by: Ben Dooks <ben.dooks@xxxxxxxxxxxxxxx>
> > ---
> > drivers/pnp/base.h | 2 +-
> > drivers/pnp/support.c | 4 ++--
> > 2 files changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/pnp/base.h b/drivers/pnp/base.h
> > index b342570d0236..7b666b6ac40e 100644
> > --- a/drivers/pnp/base.h
> > +++ b/drivers/pnp/base.h
> > @@ -11,7 +11,7 @@ extern const struct bus_type pnp_bus_type;
> > int pnp_register_protocol(struct pnp_protocol *protocol);
> >
> > #define PNP_EISA_ID_MASK 0x7fffffff
> > -void pnp_eisa_id_to_string(u32 id, char *str);
> > +void pnp_eisa_id_to_string(__be32 id, char *str);
> > struct pnp_dev *pnp_alloc_dev(struct pnp_protocol *, int id,
> > const char *pnpid);
> > struct pnp_card *pnp_alloc_card(struct pnp_protocol *, int id, char *pnpid);
> > diff --git a/drivers/pnp/support.c b/drivers/pnp/support.c
> > index f6c866851769..07c9844680ac 100644
> > --- a/drivers/pnp/support.c
> > +++ b/drivers/pnp/support.c
> > @@ -37,9 +37,9 @@ EXPORT_SYMBOL(pnp_is_active);
> > * Functionally similar to acpi_ex_eisa_id_to_string(), but that's
> > * buried in the ACPI CA, and we can't depend on it being present.
> > */
> > -void pnp_eisa_id_to_string(u32 id, char *str)
> > +void pnp_eisa_id_to_string(__be32 _id, char *str)
> > {
> > - id = be32_to_cpu(id);
> > + u32 id = be32_to_cpu(_id);
> >
> > /*
> > * According to the specs, the first three characters are five-bit
> > --
>
> Applied as 7.2-rc material, thanks!
And dropped because it causes sparse to complain:
https://lore.kernel.org/linux-acpi/202606241828.hRy0jZOE-lkp@xxxxxxxxx/