Re: [PATCH] kconfig: fix submenu rendering of negative dependencies

From: Nathan Chancellor

Date: Thu Jul 30 2026 - 21:04:01 EST


> This fixes the "ironic visualization" issue reported here:
> https://lore.kernel.org/linux-kbuild/cbe95c15d2760f6fce8eaf207c969ce8fd3703aa.camel@xxxxxxxxxxx/
>
> where a config option FOO is nested in the submenu of the previous option
> BAR, despite FOO actually depending on !BAR.

I would prefer to have a short standalone blurb about the issue reported
at that link so that the commit message is self-contained. Move the link
to the trailers with the Closes: tag.

> I've only tested locally on x86, but as far as I can tell, this only
> changes how 2 options are rendered in the menu:
> 1. NTFS3_FS, no longer in the NTFS_FS submenu, and
> 2. MTD_BLOCK_RO, no longer in the MTD_BLOCK submenu.

These both seem like correct changes from what I can tell.

> Assisted-by: Claude:claude-4.8-opus
> Signed-off-by: Julian Braha <julianbraha@xxxxxxxxx>

Tested-by: Nathan Chancellor <nathan@xxxxxxxxxx>

> diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c
> index 16f92c4a775a..2b91d16bf14f 100644
> --- a/scripts/kconfig/expr.c
> +++ b/scripts/kconfig/expr.c
> @@ -738,6 +738,39 @@ bool expr_contains_symbol(struct expr *dep, struct symbol *sym)
> return false;
> }
>
> +/*
> + * Check if the expression references 'sym' in a way that is satisfiable
> + * with 'sym' disabled, e.g.'sym!=y'.
> + *
> + * Expects that expr_transform() was already called on 'expr'.
> + */
> +bool expr_contains_symbol_negated(struct expr *dep, struct symbol *sym)

I get that this mostly mirrors expr_contains_symbol() but I am not sure
I love the name since the symbol might not actually be negated. That
said, I don't really have a better suggestion :/

--
Cheers,
Nathan