[2/8] kconfig: use parent->dep as the parentdep of 'menu'
diff mbox series

Message ID 20191217041424.29285-3-masahiroy@kernel.org
State New
Headers show
Series
  • kconfig: misc cleanups
Related show

Commit Message

Masahiro Yamada Dec. 17, 2019, 4:14 a.m. UTC
In menu_finalize(), the dependency of a menu entry is propagated
downwards.

For the 'menu', ->dep and ->prompt->visible.expr are the same.
Both accumulate the 'depends on' of itself and upper menu entries.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/kconfig/menu.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Masahiro Yamada Dec. 17, 2019, 5:55 a.m. UTC | #1
On Tue, Dec 17, 2019 at 1:14 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> In menu_finalize(), the dependency of a menu entry is propagated
> downwards.
>
> For the 'menu', ->dep and ->prompt->visible.expr are the same.

Just for clarification, this means
parent->dep and parent->prompt->visible.expr
have the same expression.

expr_eq(parent->dep, parent->prompt->visible.expr)
should return 1.



> Both accumulate the 'depends on' of itself and upper menu entries.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
>
>  scripts/kconfig/menu.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
> index b1b1ee8cf987..bbabf0a59ac4 100644
> --- a/scripts/kconfig/menu.c
> +++ b/scripts/kconfig/menu.c
> @@ -326,12 +326,10 @@ void menu_finalize(struct menu *parent)
>                          * choice value symbols.
>                          */
>                         parentdep = expr_alloc_symbol(sym);
> -               } else if (parent->prompt)
> -                       /* Menu node for 'menu' */
> -                       parentdep = parent->prompt->visible.expr;
> -               else
> -                       /* Menu node for 'if' */
> +               } else {
> +                       /* Menu node for 'menu', 'if' */
>                         parentdep = parent->dep;
> +               }
>
>                 /* For each child menu node... */
>                 for (menu = parent->list; menu; menu = menu->next) {
> --
> 2.17.1
>

Patch
diff mbox series

diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index b1b1ee8cf987..bbabf0a59ac4 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -326,12 +326,10 @@  void menu_finalize(struct menu *parent)
 			 * choice value symbols.
 			 */
 			parentdep = expr_alloc_symbol(sym);
-		} else if (parent->prompt)
-			/* Menu node for 'menu' */
-			parentdep = parent->prompt->visible.expr;
-		else
-			/* Menu node for 'if' */
+		} else {
+			/* Menu node for 'menu', 'if' */
 			parentdep = parent->dep;
+		}
 
 		/* For each child menu node... */
 		for (menu = parent->list; menu; menu = menu->next) {