diff mbox series

[4/7] linux-kbuild: fix: ensure selected configs were turned on in original

Message ID 20240913171205.22126-5-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:11 p.m. UTC
Ensure that only modules that were turned on in the original config are
turned on in the new config file. When ensuring that the config
dependencies are met, turning on the config options in the new config
leads to warnings and errors later in this script, especially for badly
constructed original config files.

One example could be a config option that is depended on by a module
needed in the new config but is not turned on in the original config
file. If this config needs to be selected, warnings will show up in the
standard output.

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

Comments

Masahiro Yamada Sept. 24, 2024, 3:45 a.m. UTC | #1
On Sat, Sep 14, 2024 at 2:12 AM David Hunter
<david.hunter.linux@gmail.com> wrote:
>
> Ensure that only modules that were turned on in the original config are
> turned on in the new config file. When ensuring that the config
> dependencies are met, turning on the config options in the new config
> leads to warnings and errors later in this script, especially for badly
> constructed original config files.
>
> One example could be a config option that is depended on by a module
> needed in the new config but is not turned on in the original config
> file. If this config needs to be selected, warnings will show up in the
> standard output.
>
> Signed-off-by: David Hunter <david.hunter.linux@gmail.com>
> ---
>  scripts/kconfig/streamline_config.pl | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
> index bb1f19a1ab5e..26e544744579 100755
> --- a/scripts/kconfig/streamline_config.pl
> +++ b/scripts/kconfig/streamline_config.pl
> @@ -459,7 +459,9 @@ sub parse_config_depends
>                 next;
>             }
>
> -           if (!defined($configs{$conf})) {
> +           # This script does not turn on any modules, so make sure the config
> +           # options are on in the original.
> +           if (!defined($configs{$conf}) && defined($orig_configs{$conf})) {
>                 # We must make sure that this config has its
>                 # dependencies met.
>                 $repeat = 1; # do again



I believe defined($orig_configs{$conf} is always true here
because it was already checked a few lines above.


    # We only need to process if the depend config is a module
    if (!defined($orig_configs{$conf}) || $orig_configs{$conf} eq "y") {
        next;
    }


If $conf is not present in the original .config,
the 'next' statement skips the current iteration.






--
Best Regards
Masahiro Yamada
David Hunter Oct. 14, 2024, 2:38 p.m. UTC | #2
On 9/23/24 23:45, Masahiro Yamada wrote:

> I believe defined($orig_configs{$conf} is always true here
> because it was already checked a few lines above.
> 
> 
>      # We only need to process if the depend config is a module
>      if (!defined($orig_configs{$conf}) || $orig_configs{$conf} eq "y") {
>          next;
>      }
> 
> 
> If $conf is not present in the original .config,
> the 'next' statement skips the current iteration.
> 


Good point, I will remove this portion for the series patch.
diff mbox series

Patch

diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
index bb1f19a1ab5e..26e544744579 100755
--- a/scripts/kconfig/streamline_config.pl
+++ b/scripts/kconfig/streamline_config.pl
@@ -459,7 +459,9 @@  sub parse_config_depends
 		next;
 	    }
 
-	    if (!defined($configs{$conf})) {
+	    # This script does not turn on any modules, so make sure the config
+	    # options are on in the original.
+	    if (!defined($configs{$conf}) && defined($orig_configs{$conf})) {
 		# We must make sure that this config has its
 		# dependencies met.
 		$repeat = 1; # do again