Re: [PATCH] iio:accel:dmard06: Optimize when CONFIG_OF isn't set

From: Jean Delvare
Date: Fri Aug 26 2022 - 06:46:18 EST


Hi Andy,

On Thu, 25 Aug 2022 23:12:43 +0300, Andy Shevchenko wrote:
> On Thu, Aug 25, 2022 at 3:54 PM Jean Delvare <jdelvare@xxxxxxx> wrote:
> >
> > When CONFIG_OF isn't set, we can optimize out dmard06_of_match as it
> > will never be used.
>
> NACK. There is a magic PRP0001 for ACPI case.

OK, I wasn't aware of this. As of_match_device() is a stub when
CONFIG_OF isn't set, I thought the table could never be used. But now I
see that the acpi subsystem accesses the table directly, so you are
correct, the optimization I suggested is bogus.

Now I'm curious, is there a well-defined subset of device names that
can be found in an ACPI table? If not, does that mean that any driver
with an OF entry could match, therefore of_match_ptr() should be
removed from the kernel entirely?

Another possibility would be to stub out of_match_ptr() only if neither
CONFIG_OF nor CONFIG_ACPI is set. But I'm not sure that would be worth,
as I expected either to be set on almost all kernels in practice
(except on s390x, but you wouldn't build any of these drivers there
anyway).

--
Jean Delvare
SUSE L3 Support