mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] kconfig: keep builtin precedence with duplicate fragment entries
@ 2026-09-28 23:45 omer zalman
  2026-09-29 12:10 ` Nicolas Schier
  0 siblings, 1 reply; 2+ messages in thread
From: omer zalman @ 2026-09-28 23:45 UTC (permalink / raw)
  To: Nathan Chancellor, nsc; +Cc: linux-kbuild, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 528 bytes --]

The -y option is meant to preserve a builtin value when a fragment
requests a module. With duplicate CONFIG_FOO=m lines, only the last
fragment line is skipped; an earlier one remains after CONFIG_FOO=y.
Kconfig reads the later assignment and can demote the symbol. Track
the symbol instead of one line, and skip all of its assignments
when builtin precedence applies.

Signed-off-by: Omer Zalman <omerzalman42@gmail.com>

The exact git-format-patch file is attached because Gmail's web
composer removes tabs from inline diffs.

[-- Attachment #2: 03-kconfig-duplicate-fragments.patch --]
[-- Type: application/octet-stream, Size: 1886 bytes --]

From ecda981a106f7d94c6e6feb184cbcfe2e70b9c1e Mon Sep 17 00:00:00 2001
From: Omer Zalman <omerzalman42@gmail.com>
Date: Sun, 27 Sep 2026 08:41:10 -0400
Subject: [PATCH] kconfig: keep builtin precedence with duplicate fragment
 entries
To: Nathan Chancellor <nathan@kernel.org>, Nicolas Schier <nsc@kernel.org>
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org

From: Omer Zalman <omerzalman42@gmail.com>

The -y option is meant to preserve a builtin value when a fragment
requests a module. With duplicate CONFIG_FOO=m lines, only the last
fragment line is skipped; an earlier one remains after CONFIG_FOO=y.
Kconfig reads the later assignment and can demote the symbol. Track
the symbol instead of one line, and skip all of its assignments
when builtin precedence applies.

Signed-off-by: Omer Zalman <omerzalman42@gmail.com>
---
 scripts/kconfig/merge_config.sh | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh
index ec242e0..86a4af8 100644
--- a/scripts/kconfig/merge_config.sh
+++ b/scripts/kconfig/merge_config.sh
@@ -202,7 +202,6 @@ for ORIG_MERGE_FILE in $MERGE_LIST ; do
 		cfg = get_cfg($0)
 		if (cfg != "") {
 			merge_cfg[cfg] = $0
-			merge_cfg_line[cfg] = FNR
 		}
 		next
 	}
@@ -224,7 +223,7 @@ for ORIG_MERGE_FILE in $MERGE_LIST ; do
 		if (builtin == "true" && new_val ~ /=m$/ && prev_val ~ /=y$/) {
 			warn_builtin(cfg, prev_val, new_val)
 			print $0 >> outfile
-			skip_merge[merge_cfg_line[cfg]] = 1
+			skip_cfg[cfg] = 1
 			next
 		}
 
@@ -252,7 +251,7 @@ for ORIG_MERGE_FILE in $MERGE_LIST ; do
 		print "" >> outfile
 		# Append merge file, skipping lines marked for builtin preservation
 		for (i = 1; i <= merge_total; i++) {
-			if (!(i in skip_merge)) {
+			if (!(get_cfg(merge_lines[i]) in skip_cfg)) {
 				print merge_lines[i] >> outfile
 			}
 		}

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] kconfig: keep builtin precedence with duplicate fragment entries
  2026-09-28 23:45 [PATCH] kconfig: keep builtin precedence with duplicate fragment entries omer zalman
@ 2026-09-29 12:10 ` Nicolas Schier
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Schier @ 2026-09-29 12:10 UTC (permalink / raw)
  To: omer zalman; +Cc: Nathan Chancellor, linux-kbuild, linux-kernel

On Mon, Sep 28, 2026 at 07:45:22PM -0400, omer zalman wrote:
> The -y option is meant to preserve a builtin value when a fragment
> requests a module. With duplicate CONFIG_FOO=m lines, only the last
> fragment line is skipped; an earlier one remains after CONFIG_FOO=y.
> Kconfig reads the later assignment and can demote the symbol. Track
> the symbol instead of one line, and skip all of its assignments
> when builtin precedence applies.
> 
> Signed-off-by: Omer Zalman <omerzalman42@gmail.com>
> 
> The exact git-format-patch file is attached because Gmail's web
> composer removes tabs from inline diffs.

I did not have time for review, yet; just a heads-up:  Sending patches
via attachments is incompatible to standard tooling (b4, etc.) and thus
requires more manual work.  One way to work-around gmails restrictions
might be the use of b4's web-submission endpoint:

https://b4.docs.kernel.org/en/latest/contributor/send.html#authenticating-with-the-web-submission-endpoint

-- 
Nicolas

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-29 12:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-28 23:45 [PATCH] kconfig: keep builtin precedence with duplicate fragment entries omer zalman
2026-09-29 12:10 ` Nicolas Schier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®