Re: [PATCH] drivers: gpio: use of_match_ptr() and ACPI_PTR() macros
From: Lee Jones
Date: Tue Nov 17 2020 - 11:02:07 EST
On Tue, 17 Nov 2020, Thierry Reding wrote:
> On Tue, Nov 17, 2020 at 04:43:40PM +0100, Enrico Weigelt, metux IT consult wrote:
> > The of_match_ptr(foo) macro evaluates to foo, only if
> > CONFIG_OF is set, otherwise to NULL. Same does ACPI_PTR with
> > CONFIG_ACPI. That's very helpful for drivers that can be used
> > with or without oftree / acpi.
> >
> > Even though most of the drivers touched here probably don't
> > actually need that, it's also nice for consistency to make it
> > the de-facto standard and change all drivers to use the
> > of_match_ptr() and ACPI_PTR() macros.
> >
> > A nice side effect: in some situations, when compiled w/o
> > CONFIG_OF/CONFIG_ACPI, the corresponding match tables could
> > automatically become unreferenced and optimized-away by the
> > compiler, w/o explicitly cluttering the code w/ ifdef's.
>
> Isn't this going to cause a lot of "defined but unused" warnings when
> built without OF support, for example?
Yes, it will.
It also looks like there are some whitespace changes in the patch,
unless of course that's just Git playing tricks!
--
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog