From: "Arnd Bergmann" <arnd@arndb.de>
To: "Nathan Chancellor" <nathan@kernel.org>,
"Graham Roff" <grahamr@qti.qualcomm.com>
Cc: "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 v2] Support conditional deps using "depends on X if Y"
Date: Fri, 05 Dec 2025 09:01:51 +0100 [thread overview]
Message-ID: <b4be7637-9446-47d0-9a8c-3fd0f55a27b9@app.fastmail.com> (raw)
In-Reply-To: <20251205015352.GA2060615@ax162>
On Fri, Dec 5, 2025, at 02:53, Nathan Chancellor wrote:
> On Tue, Nov 18, 2025 at 10:46:51AM -0800, Graham Roff wrote:
>>
>> arch/arm64/Kconfig:
>> depends on ARM64_64K_PAGES || !ARM64_VA_BITS_52 -->
>> depends on ARM64_64K_PAGES if ARM64_VA_BITS_52
>> arch/mips/Kconfig:
>> depends on SYS_SUPPORTS_HOTPLUG_CPU || !SMP -->
>> depends on SYS_SUPPORTS_HOTPLUG_CPU if SMP
>> arch/riscv/Kconfig:
>> depends on CC_HAS_MIN_FUNCTION_ALIGNMENT || !RISCV_ISA_C -->
>> depends on CC_HAS_MIN_FUNCTION_ALIGNMENT if RISCV_ISA_C
>> arch/x86/Kconfig:
>> depends on X86_64 || !SPARSEMEM -->
>> depends on X86_64 if SPARSEMEM
>> drivers/acpi/Kconfig:
>> depends on ACPI_WMI || !X86 -->
>> depends on ACPI_WMI if X86
>> drivers/bluetooth/Kconfig:
>> depends on USB || !BT_HCIBTUSB_MTK
>> depends on USB if BT_HCIBTUSB_MTK
>> mm/Kconfig:
>> depends on !ARM || CPU_CACHE_VIPT -->
>> depends on CPU_CACHE_VIPT if ARM
>> kernel/Kconfig.locks:
>> depends on !PREEMPTION || ARCH_INLINE_READ_UNLOCK -->
>> depends on ARCH_INLINE_READ_UNLOCK if PREEMPTION
>
> On the surface, the vast majority these become more readable using the
> 'if' syntax.
Agreed, the question is whether a small improvement in
readability is worth the complexity of having multiple
ways of expressing the same thing.
I don't see anything that the new syntax would allow
that we were currently missing.
>> @@ -602,8 +612,14 @@ Some drivers are able to optionally use a feature from another module
>> or build cleanly with that module disabled, but cause a link failure
>> when trying to use that loadable module from a built-in driver.
>>
>> -The most common way to express this optional dependency in Kconfig logic
>> -uses the slightly counterintuitive::
>> +The recommended way to express this optional dependency in Kconfig logic
>> +uses the conditional form::
>> +
>> + config FOO
>> + tristate "Support for foo hardware"
>> + depends on BAR if BAR
>> +
>> +This slightly counterintuitive style is also widely used::
>>
This is the bit that frequently confuses developers with the
current syntax, and I agree it would be nice to have a better
way, but I'm not sure the proposal actually helps enough to
warrant a mass-conversion of existing Kconfig files.
>> +config TEST_COMPLEX
>> + bool "Test complex conditional dependency"
>> + depends on (FOO && BAR) if (FOO || BAR)
>> + default y
With the existing syntax, this could be expressed as
depends on FOO = BAR
or
depends on (FOO && BAR) || (!FOO && !BAR)
and I don't see how the new syntax is an improvement
over these.
Overall, I'm not convinced by this patch. I have no strong
objection to anything in here, but I'm worried that extending
the syntax adds more problems than this one solves.
Arnd
next prev parent reply other threads:[~2025-12-05 8:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-18 18:46 [PATCH v2] Support conditional deps using "depends on X if Y" Graham Roff
2025-12-05 1:53 ` Nathan Chancellor
2025-12-05 8:01 ` Arnd Bergmann [this message]
2025-12-05 16:14 ` Nicolas Pitre
2025-12-05 18:23 ` Nathan Chancellor
2025-12-09 22:45 ` Graham Roff
2025-12-10 15:07 ` Jani Nikula
2025-12-13 1:40 ` Nathan Chancellor
2025-12-05 9:06 ` Jani Nikula
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=b4be7637-9446-47d0-9a8c-3fd0f55a27b9@app.fastmail.com \
--to=arnd@arndb.de \
--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).