Re: [PATCH] Documentation: warn users not to use select on choice options in Kconfig
Nathan Chancellor <[email protected]> Mon, 3 Aug 2026 10:47:36 -0700
| Newsgroups | gmane.linux.kbuild.devel,gmane.linux.kernel,gmane.linux.documentation |
|---|---|
| Message-ID | <20260803174736.GA1067866@ax162> |
On Sun, Aug 02, 2026 at 08:36:58PM +0100, Julian Braha wrote: > On 8/2/26 20:13, Nicolas Schier wrote: > > 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) ... > 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/[email protected]/ > 2. > https://lore.kernel.org/all/[email protected]/ > 3. > https://lore.kernel.org/all/[email protected]/ > 4. > https://lore.kernel.org/all/[email protected]/ > > With #5 already in linux-next: > 5. > https://lore.kernel.org/all/[email protected]/ > > > 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. It looks like number 4 has been picked up as well. Given that we only need three more patches to be accepted to turn this into a hard error, I think it would be better to hold off on taking the documentation patch and just push for the hard error next cycle. If these patches are not applied to other trees before 7.3-rc1, we can ask to take them via Kbuild with Acks and/or stable branches for 7.4. -- Cheers, Nathan