diff mbox series

[1/6] kconfig: do not call check_conf() for olddefconfig

Message ID 1515567374-12722-1-git-send-email-yamada.masahiro@socionext.com
State Superseded
Headers show
Series [1/6] kconfig: do not call check_conf() for olddefconfig | expand

Commit Message

Masahiro Yamada Jan. 10, 2018, 6:56 a.m. UTC
check_conf() traverses the menu tree, but it is completely no-op for
olddefconfig because the following if-else block does nothing.

    if (input_mode == listnewconfig) {
            ...
    } else if (input_mode != olddefconfig) {
            ...
    }

As the help message says, olddefconfig automatically sets new symbols
to their default value.  There is no room for manual intervention.
So, calling check_conf() for olddefconfig is odd in the first place.
Rather, olddefconfig belongs to the group of alldefconfig and defconfig.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

---

 scripts/kconfig/conf.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

-- 
2.7.4

Comments

Ulf Magnusson Jan. 12, 2018, 12:26 p.m. UTC | #1
On Wed, Jan 10, 2018 at 7:56 AM, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> check_conf() traverses the menu tree, but it is completely no-op for

> olddefconfig because the following if-else block does nothing.

>

>     if (input_mode == listnewconfig) {

>             ...

>     } else if (input_mode != olddefconfig) {

>             ...

>     }

>

> As the help message says, olddefconfig automatically sets new symbols

> to their default value.  There is no room for manual intervention.

> So, calling check_conf() for olddefconfig is odd in the first place.

> Rather, olddefconfig belongs to the group of alldefconfig and defconfig.

>

> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

> ---

>

>  scripts/kconfig/conf.c | 10 +++++-----

>  1 file changed, 5 insertions(+), 5 deletions(-)

>

> diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c

> index 866369f..52cbe5d 100644

> --- a/scripts/kconfig/conf.c

> +++ b/scripts/kconfig/conf.c

> @@ -434,7 +434,7 @@ static void check_conf(struct menu *menu)

>                                 if (sym->name && !sym_is_choice_value(sym)) {

>                                         printf("%s%s\n", CONFIG_, sym->name);

>                                 }

> -                       } else if (input_mode != olddefconfig) {

> +                       } else {

>                                 if (!conf_cnt++)

>                                         printf(_("*\n* Restart config...\n*\n"));

>                                 rootEntry = menu_get_parent_menu(menu);

> @@ -674,15 +674,15 @@ int main(int ac, char **av)

>                 /* fall through */

>         case oldconfig:

>         case listnewconfig:

> -       case olddefconfig:

>         case silentoldconfig:

>                 /* Update until a loop caused no more changes */

>                 do {

>                         conf_cnt = 0;

>                         check_conf(&rootmenu);

> -               } while (conf_cnt &&

> -                        (input_mode != listnewconfig &&

> -                         input_mode != olddefconfig));

> +               } while (conf_cnt && input_mode != listnewconfig);

> +               break;

> +       case olddefconfig:

> +       default:

>                 break;

>         }

>

> --

> 2.7.4

>


Acked-by: Ulf Magnusson <ulfalizer@gmail.com>


Cheers,
Ulf
Ulf Magnusson Jan. 12, 2018, 4:49 p.m. UTC | #2
On Fri, Jan 12, 2018 at 1:26 PM, Ulf Magnusson <ulfalizer@gmail.com> wrote:
> On Wed, Jan 10, 2018 at 7:56 AM, Masahiro Yamada

> <yamada.masahiro@socionext.com> wrote:

>> check_conf() traverses the menu tree, but it is completely no-op for

>> olddefconfig because the following if-else block does nothing.

>>

>>     if (input_mode == listnewconfig) {

>>             ...

>>     } else if (input_mode != olddefconfig) {

>>             ...

>>     }

>>

>> As the help message says, olddefconfig automatically sets new symbols

>> to their default value.  There is no room for manual intervention.

>> So, calling check_conf() for olddefconfig is odd in the first place.

>> Rather, olddefconfig belongs to the group of alldefconfig and defconfig.

>>

>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

>> ---

>>

>>  scripts/kconfig/conf.c | 10 +++++-----

>>  1 file changed, 5 insertions(+), 5 deletions(-)

>>

>> diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c

>> index 866369f..52cbe5d 100644

>> --- a/scripts/kconfig/conf.c

>> +++ b/scripts/kconfig/conf.c

>> @@ -434,7 +434,7 @@ static void check_conf(struct menu *menu)

>>                                 if (sym->name && !sym_is_choice_value(sym)) {

>>                                         printf("%s%s\n", CONFIG_, sym->name);

>>                                 }

>> -                       } else if (input_mode != olddefconfig) {

>> +                       } else {

>>                                 if (!conf_cnt++)

>>                                         printf(_("*\n* Restart config...\n*\n"));

>>                                 rootEntry = menu_get_parent_menu(menu);

>> @@ -674,15 +674,15 @@ int main(int ac, char **av)

>>                 /* fall through */

>>         case oldconfig:

>>         case listnewconfig:

>> -       case olddefconfig:

>>         case silentoldconfig:

>>                 /* Update until a loop caused no more changes */

>>                 do {

>>                         conf_cnt = 0;

>>                         check_conf(&rootmenu);

>> -               } while (conf_cnt &&

>> -                        (input_mode != listnewconfig &&

>> -                         input_mode != olddefconfig));

>> +               } while (conf_cnt && input_mode != listnewconfig);

>> +               break;

>> +       case olddefconfig:

>> +       default:

>>                 break;

>>         }

>>

>> --

>> 2.7.4

>>

>

> Acked-by: Ulf Magnusson <ulfalizer@gmail.com>

>

> Cheers,

> Ulf


Should have been Reviewed-by, obviously. Sorry about that. :)

Cheers,
Ulf
Masahiro Yamada Jan. 17, 2018, 4:59 p.m. UTC | #3
Hi Ulf,

2018-01-13 1:49 GMT+09:00 Ulf Magnusson <ulfalizer@gmail.com>:
> On Fri, Jan 12, 2018 at 1:26 PM, Ulf Magnusson <ulfalizer@gmail.com> wrote:

>> On Wed, Jan 10, 2018 at 7:56 AM, Masahiro Yamada

>> <yamada.masahiro@socionext.com> wrote:

>>> check_conf() traverses the menu tree, but it is completely no-op for

>>> olddefconfig because the following if-else block does nothing.

>>>

>>>     if (input_mode == listnewconfig) {

>>>             ...

>>>     } else if (input_mode != olddefconfig) {

>>>             ...

>>>     }

>>>

>>> As the help message says, olddefconfig automatically sets new symbols

>>> to their default value.  There is no room for manual intervention.

>>> So, calling check_conf() for olddefconfig is odd in the first place.

>>> Rather, olddefconfig belongs to the group of alldefconfig and defconfig.

>>>

>>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

>>> ---

>>>

>>>  scripts/kconfig/conf.c | 10 +++++-----

>>>  1 file changed, 5 insertions(+), 5 deletions(-)

>>>

>>> diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c

>>> index 866369f..52cbe5d 100644

>>> --- a/scripts/kconfig/conf.c

>>> +++ b/scripts/kconfig/conf.c

>>> @@ -434,7 +434,7 @@ static void check_conf(struct menu *menu)

>>>                                 if (sym->name && !sym_is_choice_value(sym)) {

>>>                                         printf("%s%s\n", CONFIG_, sym->name);

>>>                                 }

>>> -                       } else if (input_mode != olddefconfig) {

>>> +                       } else {

>>>                                 if (!conf_cnt++)

>>>                                         printf(_("*\n* Restart config...\n*\n"));

>>>                                 rootEntry = menu_get_parent_menu(menu);

>>> @@ -674,15 +674,15 @@ int main(int ac, char **av)

>>>                 /* fall through */

>>>         case oldconfig:

>>>         case listnewconfig:

>>> -       case olddefconfig:

>>>         case silentoldconfig:

>>>                 /* Update until a loop caused no more changes */

>>>                 do {

>>>                         conf_cnt = 0;

>>>                         check_conf(&rootmenu);

>>> -               } while (conf_cnt &&

>>> -                        (input_mode != listnewconfig &&

>>> -                         input_mode != olddefconfig));

>>> +               } while (conf_cnt && input_mode != listnewconfig);

>>> +               break;

>>> +       case olddefconfig:

>>> +       default:

>>>                 break;

>>>         }

>>>

>>> --

>>> 2.7.4

>>>

>>

>> Acked-by: Ulf Magnusson <ulfalizer@gmail.com>

>>

>> Cheers,

>> Ulf

>

> Should have been Reviewed-by, obviously. Sorry about that. :)

>



I will turn it into Reviewed-by.

Anyway, thanks a lot for checking these patches!

-- 
Best Regards
Masahiro Yamada
diff mbox series

Patch

diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 866369f..52cbe5d 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -434,7 +434,7 @@  static void check_conf(struct menu *menu)
 				if (sym->name && !sym_is_choice_value(sym)) {
 					printf("%s%s\n", CONFIG_, sym->name);
 				}
-			} else if (input_mode != olddefconfig) {
+			} else {
 				if (!conf_cnt++)
 					printf(_("*\n* Restart config...\n*\n"));
 				rootEntry = menu_get_parent_menu(menu);
@@ -674,15 +674,15 @@  int main(int ac, char **av)
 		/* fall through */
 	case oldconfig:
 	case listnewconfig:
-	case olddefconfig:
 	case silentoldconfig:
 		/* Update until a loop caused no more changes */
 		do {
 			conf_cnt = 0;
 			check_conf(&rootmenu);
-		} while (conf_cnt &&
-			 (input_mode != listnewconfig &&
-			  input_mode != olddefconfig));
+		} while (conf_cnt && input_mode != listnewconfig);
+		break;
+	case olddefconfig:
+	default:
 		break;
 	}