Re: drivers/mux/adg792a.c:134:34: warning: 'adg792a_of_match' defined but not used

From: Andy Shevchenko
Date: Thu Nov 09 2023 - 08:59:49 EST


On Tue, Nov 7, 2023 at 11:39 PM Peter Rosin <peda@xxxxxxxxxx> wrote:
> 2023-11-07 at 20:59, Andy Shevchenko wrote:
> > On Mon, Nov 6, 2023 at 11:31 PM Peter Rosin <peda@xxxxxxxxxx> wrote:

...

> > The use of the of_match_ptr() is quite doubtful, no?
>
> I was trying to answer why the spi-mux addition was (wrongly) fingered as
> the first bad commit. I should have been clearer...
>
> I don't see what's wrong with using of_match_ptr() in this driver as
> CONFIG_OF is not required here. Why isn't the correct fix to instead
> put the definition of adg792a_of_match in an #ifdef CONFIG_OF block?

Because:
- it is prone to error (as evidence this report)
- it adds ugly ifdeffery and more LoCs in the code for no value
- it prevents driver to be used in ACPI

I found at least two of these arguments are serious enough to drop
that macro and not use it _at all_ generally speaking.

--
With Best Regards,
Andy Shevchenko