From: Jani Nikula <jani.nikula@linux.intel.com>
To: Nathan Chancellor <nathan@kernel.org>
Cc: Graham Roff <grahamr@qti.qualcomm.com>,
Nicolas Schier <nsc@kernel.org>, Jonathan Corbet <corbet@lwn.net>,
linux-kbuild@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, Nicolas Pitre <nico@fluxnic.net>
Subject: Re: [PATCH] Support conditional deps using "depends on X if Y"
Date: Tue, 11 Nov 2025 09:06:54 +0200 [thread overview]
Message-ID: <e5ef3c59bc100cb44adae6ef624da83af8bce299@intel.com> (raw)
In-Reply-To: <20251110211549.GB302594@ax162>
On Mon, 10 Nov 2025, Nathan Chancellor <nathan@kernel.org> wrote:
> On Mon, Nov 10, 2025 at 10:48:59AM +0200, Jani Nikula wrote:
>> "depends on A || !A" (or A=n) is the most common pattern in Kconfig,
>> which literally means "depends on A if A".
>
> That is totally fair, I did not try to actually search for the idiom. I
> will say I do not find that either expression in Kconfig easily
> translates in my head to "this dependency must be built in if the symbol
> is built in, modular if the symbol is modular, or disabled" but I guess
> that is just lack of familiarity with these idioms. I just want it to be
> obvious to folks writing Kconfig when something like this is appropriate
> to use but I guess with that being the most common usage in the tree, it
> is fine as is.
Right. I guess it takes a while to get used to the idiom A || !A. But
then is it counter-productive to add an alternative that is apparently
not much more helpful? And then we have two ways to express the same
thing.
So the follow-up questions:
- Can we come up with a more obvious alternative to the specific case of
"A || !A"?
- Can we have examples of conversions from "A || !B" to "A if B" in
kernel Kconfigs? As in, don't add features without users.
My point is, there are like 10x more "A || !A" than there are "A || !B".
Feels weird to advertize and document the thing for the latter, when the
former is the more prevalent case.
$ git grep -E "depends on .*\b([A-Z0-9_]+) \|\| (\!\1\b|\1=n)"
I'm not at all opposed to the change per se.
BR,
Jani.
--
Jani Nikula, Intel
next prev parent reply other threads:[~2025-11-11 7:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-08 1:16 [PATCH] Support conditional deps using "depends on X if Y" Graham Roff
2025-11-09 23:29 ` Nathan Chancellor
2025-11-10 8:48 ` Jani Nikula
2025-11-10 21:15 ` Nathan Chancellor
2025-11-10 22:32 ` Randy Dunlap
2025-11-11 4:09 ` Graham Roff
2025-11-11 7:06 ` Jani Nikula [this message]
2025-11-11 22:21 ` Graham Roff
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=e5ef3c59bc100cb44adae6ef624da83af8bce299@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=corbet@lwn.net \
--cc=grahamr@qti.qualcomm.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nathan@kernel.org \
--cc=nico@fluxnic.net \
--cc=nsc@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).