summaryrefslogtreecommitdiff
path: root/scripts/kconfig/menu.c
diff options
context:
space:
mode:
authorJulian Braha <julianbraha@gmail.com>2026-08-01 15:52:38 +0100
committerNicolas Schier <nsc@kernel.org>2026-08-14 21:33:20 +0200
commit35e4b60792cd45d57c3af00f67bb5bf9ae4243e9 (patch)
tree6f8733d7a33fe3552be466c2d8e70456cb6b22ed /scripts/kconfig/menu.c
parent14b8b4bf2d7bd5d58c17adbeed0edfda1dfc1a7f (diff)
kconfig: fix submenu rendering of negative dependencies
The Kconfig frontend should render options that depend on a previous option in the submenu of that previous option. But currently, this breaks for negative dependencies. For example, option FOO may be rendered in the submenu of option BAR, despite FOO actually depending on !BAR. Let's fix this ironic rendering by modifying Kconfig to explicitly check negative dependencies. 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. Tested-by: Nathan Chancellor <nathan@kernel.org> Reported-by: Xi Ruoyao <xry111@xry111.site> Closes: https://lore.kernel.org/all/cbe95c15d2760f6fce8eaf207c969ce8fd3703aa.camel@xry111.site/ Assisted-by: Claude:claude-4.8-opus Signed-off-by: Julian Braha <julianbraha@gmail.com> Link: https://patch.msgid.link/20260801145238.2140291-1-julianbraha@gmail.com Reviewed-by: Nicolas Schier <nsc@kernel.org> Tested-by: Nicolas Schier <nsc@kernel.org> Signed-off-by: Nicolas Schier <nsc@kernel.org>
Diffstat (limited to 'scripts/kconfig/menu.c')
-rw-r--r--scripts/kconfig/menu.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index b2d8d4e11e07..9c079e92a9ed 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -428,9 +428,19 @@ static void _menu_finalize(struct menu *parent, bool inside_choice)
if (!expr_contains_symbol(dep, sym))
/* No dependency, quit */
break;
+ /*
+ * Note that it's actually possible to depend on both
+ * 'SYM!=y' and 'SYM=y', so we need to first check if
+ * it's a positive dependency before checking if it's
+ * a negative dependency. See example:
+ * 'SFC && MTD && !(SFC=y && MTD=m)'
+ */
if (expr_depends_symbol(dep, sym))
/* Absolute dependency, put in submenu */
goto next;
+ if (expr_contains_symbol_negated(dep, sym))
+ /* Negative dependency, quit */
+ break;
/*
* Also consider it a dependency on sym if our