mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Aaron Tomlin <atomlin@atomlin.com>
To: nathan@kernel.org, nsc@kernel.org
Cc: julianbraha@gmail.com, atomlin@atomlin.com,
	linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] localmodconfig: Explicitly report boolean configs during integrity check
Date: Fri, 25 Sep 2026 14:12:30 -0400	[thread overview]
Message-ID: <20260925181230.130525-1-atomlin@atomlin.com> (raw)

When running make localmodconfig, streamline_config.pl reads loaded
modules and maps each module object to its corresponding Kconfig
symbol(s) using repository Makefiles.

In several instances, a loaded module corresponds to an object
controlled by a boolean symbol (e.g. config FOO declared as bool), or is
a composite module that depends on a boolean configuration. Because
boolean options only accept "=y" or disabled, they cannot be configured
as loadable modules ("=m").

Previously, if such a symbol was not already built-in ("=y") in the
baseline configuration, the final integrity check emitted an ambiguous
diagnostic. For example

    foo did not have configs CONFIG_FOO

Further investigation is required by developers to determine whether the
module was out-of-tree, its dependencies were unmet, or it failed due to
a type constraint. Address this by:
    1.  Tracking symbol types in a %types hash during Kconfig parsing.

    2.  Enhancing the final integrity check when running localmodconfig
        (!$localyesconfig) to explicitly annotate boolean symbols.

For example:

    module cec did not have configs CONFIG_CEC_CORE (tristate) CONFIG_RAS_CEC (boolean, not supported with =m)

Signed-off-by: Aaron Tomlin <atomlin@atomlin.com>
---
 scripts/kconfig/streamline_config.pl | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
index 8677d1ca06a7..6a52a98eb40e 100755
--- a/scripts/kconfig/streamline_config.pl
+++ b/scripts/kconfig/streamline_config.pl
@@ -145,6 +145,7 @@ my %prompts;
 my %objects;
 my %config2kfile;
 my %defaults;
+my %types;
 my $var;
 my $iflevel = 0;
 my @ifdeps;
@@ -224,6 +225,7 @@ sub read_kconfig {
 	} elsif ($state ne "NONE" && /^\s*def(_(bool|tristate)|ault)\s+(\S.*)$/) {
 	    my $dep = $3;
             $defaults{$config} = 1;
+	    $types{$config} = $2 if (defined($2));
 	    if ($dep !~ /^\s*(y|m|n)\s*$/) {
 		$dep =~ s/.*\sif\s+//;
 		$depends{$config} .= " " . $dep;
@@ -240,7 +242,13 @@ sub read_kconfig {
 	    }
 
 	# configs without prompts must be selected
-	} elsif ($state ne "NONE" && /^\s*(tristate\s+\S|prompt\b)/) {
+	} elsif ($state ne "NONE" && /^\s*(bool|boolean)(\s+\S.*)?$/) {
+	    $types{$config} = "bool";
+	    $prompts{$config} = 1 if (defined($2));
+	} elsif ($state ne "NONE" && /^\s*tristate(\s+\S.*)?$/) {
+	    $types{$config} = "tristate";
+	    $prompts{$config} = 1 if (defined($1));
+	} elsif ($state ne "NONE" && /^\s*prompt\b/) {
 	    # note if the config has a prompt
 	    $prompts{$config} = 1;
 
@@ -707,7 +715,15 @@ foreach my $module (keys(%modules)) {
 	}
 	print STDERR "module $module did not have configs";
 	foreach my $conf (@arr) {
-	    print STDERR " " , $conf;
+	    my $c = $conf;
+	    $c =~ s/^CONFIG_//;
+	    if (!$localyesconfig && defined($types{$c}) && $types{$c} eq "bool") {
+		print STDERR " $conf (boolean, not supported with =m)";
+	    } elsif (defined($types{$c})) {
+		print STDERR " $conf ($types{$c})";
+	    } else {
+		print STDERR " " , $conf;
+	    }
 	}
 	print STDERR "\n";
     }
-- 
2.55.0


                 reply	other threads:[~2026-09-25 18:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260925181230.130525-1-atomlin@atomlin.com \
    --to=atomlin@atomlin.com \
    --cc=julianbraha@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nathan@kernel.org \
    --cc=nsc@kernel.org \
    /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

all inboxes | Powered by JetHome®