Re: [PATCH 1/2] hwmon: gpio-fan: mark OF related data as maybe unused

From: Guenter Roeck
Date: Sun Mar 12 2023 - 17:03:45 EST


On 3/12/23 12:32, Krzysztof Kozlowski wrote:
On 12/03/2023 19:48, Guenter Roeck wrote:
On 3/12/23 11:08, Krzysztof Kozlowski wrote:
On 12/03/2023 19:06, Guenter Roeck wrote:
On Sat, Mar 11, 2023 at 12:16:09PM +0100, Krzysztof Kozlowski wrote:
The driver can be compile tested with !CONFIG_OF making certain data
unused:

drivers/hwmon/gpio-fan.c:484:34: error: ‘of_gpio_fan_match’ defined but not used [-Werror=unused-const-variable=]


How do you trigger that ? The driver depends on OF_GPIO which
in turn depends on OF. Arguably that means that of_match_ptr()
doesnot really make sense, but still I don't see how you can
trigger the above error message.

I can drop of_match_ptr, it's indeed in many cases not needed.

I just build x86_64 allyesconfig minus OF, with W=1.


x86_64 allyesconfig minus OF minus results in SENSORS_GPIO_FAN being
deselected (it doesn't show up in the configuration anymore at all
after "make olddefconfig").

$ make allyesconfig
$ grep SENSORS_GPIO_FAN .config
CONFIG_SENSORS_GPIO_FAN=y
$ sed -i -e 's/CONFIG_OF=y/# CONFIG_OF is not set/' .config
$ make olddefconfig
#
# configuration written to .config
#
$ grep SENSORS_GPIO_FAN .config
$

I suspect what you did is to disable CONFIG_OF, and then you built
the driver without realizing that is was deselected.

The driver would not built. I mean, I did not cheat here to built it
with incorrect config.

I rather suspect that config is broken due to:
WARNING: unmet direct dependencies detected for OF_GPIO
WARNING: unmet direct dependencies detected for GPIO_SYSCON
WARNING: unmet direct dependencies detected for MFD_STMFX

This was next-20230308

Interesting. That has been fixed in next-20230310, where
SENSORS_GPIO_FAN is again deselected if CONFIG_OF is disabled.


Do you want to me to drop of_match_ptr?


Yes, sure, that makes more sense. The reason though is that the
driver depends on CONFIG_OF=y, not because of the build failure.

I'll send v2 of both patches because anyway dropping of_match_ptr is
preferred.

Ok.

Thanks,
Guenter