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

From: Peter Rosin
Date: Tue Nov 07 2023 - 16:39:40 EST




2023-11-07 at 20:59, Andy Shevchenko wrote:
> On Mon, Nov 6, 2023 at 11:31 PM Peter Rosin <peda@xxxxxxxxxx> wrote:
>> 2023-11-05 at 08:35, Philip Li wrote:
>>> On Sun, Nov 05, 2023 at 09:09:00AM +0200, Andy Shevchenko wrote:
>>>> On Sun, Nov 5, 2023 at 7:03 AM kernel test robot <lkp@xxxxxxxxx> wrote:
>>>>> commit: e9e40543ad5b38b848879768359fd13650529961 spi: Add generic SPI multiplexer
>
> ...
>
>>>> I dunno why it's pointing out to that commit and some (random?) people
>>>
>>> Sorry for the incorrect bad commit, Andy. We will investigate this why
>>> it locates to this commit in the bisection process, and try to avoid
>>> similar wrong report if possible.
>>
>> In this case I think the reason is that you have CONFIG_SPI_MUX, which
>> seletcs CONFIG_MULTIPLEXER, which in turn makes CONFIG_MUX_ADG792A
>> "visible". I.e. before the fingered commit, it is likely that nothing
>> selects CONFIG_MULTIPLEXER with the given configuration.
>
> 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?

Cheers,
Peter