From: Julian Braha <julianbraha@gmail.com>
To: nathan@kernel.org, corbet@lwn.net, skhan@linuxfoundation.org,
arnd@arndb.de, stefan.hengelein@fau.de,
linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-doc@vger.kernel.org, nico@fluxnic.net,
officialnaumansabir@gmail.com, rdunlap@infradead.org,
vegard.nossum@oracle.com, kees@kernel.org, tj@kernel.org
Subject: Re: [PATCH] Documentation: warn users not to use select on choice options in Kconfig
Date: Sun, 2 Aug 2026 20:36:58 +0100 [thread overview]
Message-ID: <30650585-9d4d-4771-af7c-7c3908281719@gmail.com> (raw)
In-Reply-To: <am-W4tuI0k7MKXVP@levanger>
Hi Nicolas,
On 8/2/26 20:13, Nicolas Schier wrote:
> On Wed, Jul 15, 2026 at 11:01:49PM +0100, Julian Braha wrote:
>> Hengelein's master thesis about Kconfig from 2015 wrote that 'select'
>> does not work on member options inside of a 'choice'.
>
> is this true also for 'imply'?
Yes, the same problem goes for imply. But I didn't find any of these
'imply-choice' instances in use. Of course, if we're going to warn /
error for select, then it makes sense to do the same for imply.
> Adding the check to kconfig seems to be
> pretty simple:
>
> diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
> index b2d8d4e11e07..149d3ee59b58 100644
> --- a/scripts/kconfig/menu.c
> +++ b/scripts/kconfig/menu.c
> @@ -287,6 +287,11 @@ static void sym_check_prop(struct symbol *sym)
> "'%s' has wrong type. '%s' only "
> "accept arguments of bool and "
> "tristate type", sym2->name, use);
> + if (sym_is_choice_value(sym2))
> + prop_warn(prop,
> + "config symbol '%s' uses %s for '%s', "
> + "but '%s' is a choice value", sym->name,
> + use, sym2->name, sym2->name);
> break;
> case P_RANGE:
> if (sym->type != S_INT && sym->type != S_HEX)
>
> which currently reveals
>
> kernel/time/Kconfig:136:warning: config symbol 'NO_HZ_FULL' uses select for 'VIRT_CPU_ACCOUNTING_GEN', but 'VIRT_CPU_ACCOUNTING_GEN' is a choice value
> drivers/mtd/maps/Kconfig:104:warning: config symbol 'MTD_PHYSMAP_IXP4XX' uses select for 'MTD_CFI_BE_BYTE_SWAP', but 'MTD_CFI_BE_BYTE_SWAP' is a choice value
> drivers/tee/qcomtee/Kconfig:8:warning: config symbol 'QCOMTEE' uses select for 'QCOM_TZMEM_MODE_SHMBRIDGE', but 'QCOM_TZMEM_MODE_SHMBRIDGE' is a choice value
>
> on linux-next, with the NO_HZ_FULL also being addressed by Julian [1].
>
> Julian, please call out if you want help for pushing these.
Thanks for offering :)
I actually detected 5 of these across all architectures, and already
submitted patches for all of them (thank you, Arnd, for all of your
help):
1.
https://lore.kernel.org/all/20260729203845.387239-1-julianbraha@gmail.com/
2.
https://lore.kernel.org/all/20260801160140.2391000-1-julianbraha@gmail.com/
3.
https://lore.kernel.org/all/20260714112047.2304856-1-julianbraha@gmail.com/
4.
https://lore.kernel.org/all/20260723104933.117413-1-julianbraha@gmail.com/
With #5 already in linux-next:
5.
https://lore.kernel.org/all/20260723122818.437802-1-julianbraha@gmail.com/
> I am considering to prepare a patch and add it for kbuild-for-next (but
> not to kbuild-next) to raise attention.
I think the Kconfig interpreter should completely error out for these,
but of course, we need to wait all of these patches to be applied first.
- Julian Braha
next prev parent reply other threads:[~2026-08-02 19:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-15 22:01 [PATCH] Documentation: warn users not to use select on choice options in Kconfig Julian Braha
2026-07-16 4:19 ` Kees Cook
2026-07-16 6:04 ` Julian Braha
2026-07-29 15:10 ` Jani Nikula
2026-07-21 10:59 ` Nicolas Schier
2026-08-02 19:13 ` Nicolas Schier
2026-08-02 19:36 ` Julian Braha [this message]
2026-08-03 17:47 ` Nathan Chancellor
2026-08-03 18:26 ` Julian Braha
2026-08-04 11:47 ` Nicolas Schier
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=30650585-9d4d-4771-af7c-7c3908281719@gmail.com \
--to=julianbraha@gmail.com \
--cc=arnd@arndb.de \
--cc=corbet@lwn.net \
--cc=kees@kernel.org \
--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=officialnaumansabir@gmail.com \
--cc=rdunlap@infradead.org \
--cc=skhan@linuxfoundation.org \
--cc=stefan.hengelein@fau.de \
--cc=tj@kernel.org \
--cc=vegard.nossum@oracle.com \
/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