[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e7d33579-d58e-48b7-b0c4-bb77ea1bd788@linaro.org>
Date: Mon, 17 Feb 2025 12:00:19 +0100
From: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
To: Arnd Bergmann <arnd@...db.de>, Masahiro Yamada <masahiroy@...nel.org>,
Nathan Chancellor <nathan@...nel.org>, Nicolas Schier <nicolas@...sle.eu>,
Jonathan Corbet <corbet@....net>, linux-kbuild@...r.kernel.org,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] docs: kconfig: Mention IS_REACHABLE as way for
optional dependency
On 17/02/2025 08:51, Arnd Bergmann wrote:
> On Sat, Feb 15, 2025, at 14:17, Krzysztof Kozlowski wrote:
>> Several drivers express optional Kconfig dependency with FOO || !FOO,
>> but for many choices this is neither suitable (lack of stubs for !FOO
>> like in HWMON) nor really needed and driver can be built in even if FOO
>> is the module. This is achieved with IS_REACHABLE, so move earlier
>> section from "imply" chapter to "Optional dependencies" and grow the
>> description.
>>
>> Cc: Masahiro Yamada <masahiroy@...nel.org>
>> Cc: Arnd Bergmann <arnd@...db.de>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
>
> I think this needs to be more strongly worded to heavy discourage
> the use of IS_REACHABLE(). In most cases, anyone trying this has
> just given up on writing correct dependencies and works around
> it in a user-hostile way.
>
Ack
>> +1. If pre-processor can discard entire optional code or module BAR does not
>> + provide !BAR stubs then call can be guarded with IS_REACHABLE()::
>> +
>> + foo_init()
>> + {
>> + if (IS_REACHABLE(CONFIG_BAR))
>> + bar_register(&foo);
>> + ...
>> + }
>> +
>> + Drawback: this might lead to run-time debugging, when looking why
>> + bar_register() was not called.
>
> From this description, I wouldn't expect most readers to understand
> what you mean with "run-time debugging". The behavior that users
> are going to see is just a bug -- they turned on CONFIG_BAR=m because
> they wanted to use BAR, but then it doesn't work.
Ack
Best regards,
Krzysztof
Powered by blists - more mailing lists