From: "Arnd Bergmann" <arnd@arndb.de>
To: "Krzysztof Kozlowski" <krzysztof.kozlowski@linaro.org>,
"Masahiro Yamada" <masahiroy@kernel.org>,
"Nathan Chancellor" <nathan@kernel.org>,
"Nicolas Schier" <nicolas@fjasle.eu>,
"Jonathan Corbet" <corbet@lwn.net>,
linux-kbuild@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] docs: kconfig: Mention IS_REACHABLE as way for optional dependency
Date: Mon, 17 Feb 2025 08:51:39 +0100 [thread overview]
Message-ID: <eda7d555-d34d-4418-8fc4-a874dcca91fa@app.fastmail.com> (raw)
In-Reply-To: <20250215131739.220629-1-krzysztof.kozlowski@linaro.org>
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@kernel.org>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.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.
> +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.
Arnd
next prev parent reply other threads:[~2025-02-17 7:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-15 13:17 Krzysztof Kozlowski
2025-02-17 7:51 ` Arnd Bergmann [this message]
2025-02-17 11:00 ` Krzysztof Kozlowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=eda7d555-d34d-4418-8fc4-a874dcca91fa@app.fastmail.com \
--to=arnd@arndb.de \
--cc=corbet@lwn.net \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=nathan@kernel.org \
--cc=nicolas@fjasle.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®