Re: [PATCH] Support conditional deps using "depends on X if Y"
From: Jani Nikula
Date: Tue Nov 11 2025 - 02:19:13 EST
On Mon, 10 Nov 2025, Nathan Chancellor <nathan@xxxxxxxxxx> 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