diff mbox series

[7/7] linux-kbuild: fix: process config options set to "y"

Message ID 20240913171205.22126-8-david.hunter.linux@gmail.com (mailing list archive)
State New
Headers show
Series [1/7] linux-kbuild: fix: config option can be bool | expand

Commit Message

David Hunter Sept. 13, 2024, 5:12 p.m. UTC
The goal of "make localmodconfig" is to turn off modules that are not
necessary. Some modules are necessary because they are depended on by
config options set with a "y."

Process configs set to "y" so that the modules that are depended on
will not be turned off later.

Signed-off-by: David Hunter <david.hunter.linux@gmail.com>
---
 scripts/kconfig/streamline_config.pl | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

Comments

Masahiro Yamada Sept. 24, 2024, 4:21 a.m. UTC | #1
On Sat, Sep 14, 2024 at 2:13 AM David Hunter
<david.hunter.linux@gmail.com> wrote:
>
> The goal of "make localmodconfig" is to turn off modules that are not
> necessary. Some modules are necessary because they are depended on by
> config options set with a "y."
>
> Process configs set to "y" so that the modules that are depended on
> will not be turned off later.


You need to put the explanation in the cover letter.

Without reading the cover-letter, I do not understand
why this change is needed.





> Signed-off-by: David Hunter <david.hunter.linux@gmail.com>
> ---
>  scripts/kconfig/streamline_config.pl | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
> index 948437aac535..762bf80408c7 100755
> --- a/scripts/kconfig/streamline_config.pl
> +++ b/scripts/kconfig/streamline_config.pl
> @@ -466,6 +466,11 @@ foreach my $line (@config_file) {
>
>      if (/(CONFIG_[$valid]*)=(m|y)/) {
>         $orig_configs{$1} = $2;
> +       # all configs options set to 'y' need to be processed
> +       if($2 eq "y") {
> +            $configs{$1}= $2;
> +        }
> +


You are breaking the indentation style.

Check how the current code is indented.
(tab and spaces).


A space is needed after 'if'
for coding style consistency.




>      }
>  }
>
> @@ -596,9 +601,11 @@ sub loop_depend {
>        forloop:
>         foreach my $config (keys %configs) {
>
> -           # If this config is not a module, we do not need to process it
> -           if (defined($orig_configs{$config}) && $orig_configs{$config} ne "m") {
> -               next forloop;
> +           # If this config is not set in the original config,
> +           # we do not need to process it
> +           if (defined($orig_configs{$config}) && $orig_configs{$config} ne "m"
> +                       && $orig_configs{$config} ne "y")  {
> +                   next forloop;
>             }



I do not understand the condition:


defined($orig_configs{$config}) && $orig_configs{$config} ne "m"
      && $orig_configs{$config} ne "y"


Is there any case when this condition is met?











>             $config =~ s/^CONFIG_//;
> --
> 2.43.0
>
David Hunter Oct. 10, 2024, 8:47 p.m. UTC | #2
> Is there any case when this condition is met?
> 
> 
On my computer, there are no cases where this condition is met. I am 
aware of config options that are numbers or are strings; however, I am 
unsure if any of them are dependencies for another config.

If you would like me to, I can make a script that can figure this out. 
Even if there are config options like this, though, I am not sure that 
skipping them would be the right thing to do. I think the best thing to 
do would be to remove this condition.

Let me know if you would like me to make a script to find out how many 
config entries are simultaneously not tristate and dependencies for 
other config entries. Also let me know if you think that I should leave 
the condition in.

My version 2 of this patch will not have the condtion in it.
Thanks,
David Hunter
David Hunter Oct. 14, 2024, 2:42 p.m. UTC | #3
Version 2: 
https://lore.kernel.org/all/20241014141345.5680-7-david.hunter.linux@gmail.com/
diff mbox series

Patch

diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
index 948437aac535..762bf80408c7 100755
--- a/scripts/kconfig/streamline_config.pl
+++ b/scripts/kconfig/streamline_config.pl
@@ -466,6 +466,11 @@  foreach my $line (@config_file) {
 
     if (/(CONFIG_[$valid]*)=(m|y)/) {
 	$orig_configs{$1} = $2;
+	# all configs options set to 'y' need to be processed
+	if($2 eq "y") {
+            $configs{$1}= $2;
+        }
+
     }
 }
 
@@ -596,9 +601,11 @@  sub loop_depend {
       forloop:
 	foreach my $config (keys %configs) {
 
-	    # If this config is not a module, we do not need to process it
-	    if (defined($orig_configs{$config}) && $orig_configs{$config} ne "m") {
-		next forloop;
+           # If this config is not set in the original config,
+	    # we do not need to process it
+           if (defined($orig_configs{$config}) && $orig_configs{$config} ne "m"
+		    	&& $orig_configs{$config} ne "y")  {
+		    next forloop;
 	    }
 
 	    $config =~ s/^CONFIG_//;