[PATCH] ACPI: Add memory semantics to acpi_os_map_memory()

Lorenzo Pieralisi lorenzo.pieralisi at arm.com
Tue Jul 27 09:38:45 PDT 2021


On Tue, Jul 27, 2021 at 12:09:47PM +0200, Ard Biesheuvel wrote:

[...]

> > > > +void __iomem __ref
> > > > +*acpi_os_map_iomem(acpi_physical_address phys, acpi_size size)
> > >
> > > I am aware that this just duplicated the prototype above, but I think
> > > this should be
> > >
> > > void __iomem *__ref
> > >
> > > given that the __ref comes after the * in the prototype below.
> >
> > Yes I just moved/duplicated the prototype above but I believe this is
> > consistent with include/acpi/acpi_io.h unless I have not understood
> > what you meant ?
> >
> > It is probably worth changing it in both places to
> >
> > void __iomem *__ref
> >
> > ?
> >
> > I can do that with an additional patch.
> >
> 
> Yes, as long as they are all mutually consistent. The __ref is not
> part of the type at all, so it should not be between the void and the
> *, even if the compiler appears to allow it.

Updated into a small series, will repost next week when I am back.

Thanks,
Lorenzo

> > > > +{
> > > > +       return __acpi_os_map_iomem(phys, size, false);
> > > > +}
> > > >  EXPORT_SYMBOL_GPL(acpi_os_map_iomem);
> > > >
> > > >  void *__ref acpi_os_map_memory(acpi_physical_address phys, acpi_size size)
> > > >  {
> > > > -       return (void *)acpi_os_map_iomem(phys, size);
> > > > +       return (void *)__acpi_os_map_iomem(phys, size, true);
> > >
> > > I think this should be (__force void *) to shut up sparse address
> > > space warnings.
> >
> > Yes I can add that attribute in an additional patch and rebase this one
> > on top of it.
> >
> > Thanks,
> > Lorenzo
> >
> > >
> > > >  }
> > > >  EXPORT_SYMBOL_GPL(acpi_os_map_memory);
> > > >
> > > > diff --git a/include/acpi/acpi_io.h b/include/acpi/acpi_io.h
> > > > index 027faa8883aa..a0212e67d6f4 100644
> > > > --- a/include/acpi/acpi_io.h
> > > > +++ b/include/acpi/acpi_io.h
> > > > @@ -14,6 +14,14 @@ static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
> > > >  }
> > > >  #endif
> > > >
> > > > +#ifndef acpi_os_memmap
> > > > +static inline void __iomem *acpi_os_memmap(acpi_physical_address phys,
> > > > +                                           acpi_size size)
> > > > +{
> > > > +       return ioremap_cache(phys, size);
> > > > +}
> > > > +#endif
> > > > +
> > > >  extern bool acpi_permanent_mmap;
> > > >
> > > >  void __iomem __ref
> > > > --
> > > > 2.31.0
> > > >



More information about the linux-arm-kernel mailing list