diff mbox series

[3/4] kconfig: remove P_CHOICEVAL property

Message ID 20240707153856.2483047-3-masahiroy@kernel.org (mailing list archive)
State New
Headers show
Series [1/4] kconfig: call expr_eliminate_yn() at least once in expr_eliminate_dups() | expand

Commit Message

Masahiro Yamada July 7, 2024, 3:38 p.m. UTC
This flag is unneeded because a choice member can be detected by
other means.

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

 scripts/kconfig/expr.h   | 1 -
 scripts/kconfig/gconf.c  | 2 +-
 scripts/kconfig/lkc.h    | 5 +----
 scripts/kconfig/menu.c   | 5 -----
 scripts/kconfig/symbol.c | 6 ++++++
 5 files changed, 8 insertions(+), 11 deletions(-)

Comments

Masahiro Yamada July 7, 2024, 3:40 p.m. UTC | #1
P_CHOICEVAL -> SYMBOL_CHOICEVAL


On Mon, Jul 8, 2024 at 12:39 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> This flag is unneeded because a choice member can be detected by
> other means.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
>
>  scripts/kconfig/expr.h   | 1 -
>  scripts/kconfig/gconf.c  | 2 +-
>  scripts/kconfig/lkc.h    | 5 +----
>  scripts/kconfig/menu.c   | 5 -----
>  scripts/kconfig/symbol.c | 6 ++++++
>  5 files changed, 8 insertions(+), 11 deletions(-)
>
> diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
> index 54b008c0161d..6e47e0ad6e6e 100644
> --- a/scripts/kconfig/expr.h
> +++ b/scripts/kconfig/expr.h
> @@ -131,7 +131,6 @@ struct symbol {
>
>  #define SYMBOL_CONST      0x0001  /* symbol is const */
>  #define SYMBOL_CHECK      0x0008  /* used during dependency checking */
> -#define SYMBOL_CHOICEVAL  0x0020  /* used as a value in a choice block */
>  #define SYMBOL_VALID      0x0080  /* set when symbol.curr is calculated */
>  #define SYMBOL_WRITE      0x0200  /* write symbol to file (KCONFIG_CONFIG) */
>  #define SYMBOL_WRITTEN    0x0800  /* track info to avoid double-write to .config */
> diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
> index 6b50e25133e3..c0f46f189060 100644
> --- a/scripts/kconfig/gconf.c
> +++ b/scripts/kconfig/gconf.c
> @@ -1070,7 +1070,7 @@ static gchar **fill_row(struct menu *menu)
>                 row[COL_BTNVIS] = GINT_TO_POINTER(FALSE);
>                 return row;
>         }
> -       if (sym->flags & SYMBOL_CHOICEVAL)
> +       if (sym_is_choice_value(sym))
>                 row[COL_BTNRAD] = GINT_TO_POINTER(TRUE);
>
>         stype = sym_get_type(sym);
> diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
> index 3fa46610f25f..401bdf36323a 100644
> --- a/scripts/kconfig/lkc.h
> +++ b/scripts/kconfig/lkc.h
> @@ -128,10 +128,7 @@ static inline bool sym_is_choice(const struct symbol *sym)
>         return sym->name == NULL;
>  }
>
> -static inline bool sym_is_choice_value(const struct symbol *sym)
> -{
> -       return sym->flags & SYMBOL_CHOICEVAL ? true : false;
> -}
> +bool sym_is_choice_value(const struct symbol *sym);
>
>  static inline bool sym_has_value(const struct symbol *sym)
>  {
> diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
> index 2a9b4c4f4428..cd34cc5aefcf 100644
> --- a/scripts/kconfig/menu.c
> +++ b/scripts/kconfig/menu.c
> @@ -467,11 +467,6 @@ static void _menu_finalize(struct menu *parent, bool inside_choice)
>                 sym->dir_dep.expr = expr_alloc_or(sym->dir_dep.expr, parent->dep);
>         }
>         for (menu = parent->list; menu; menu = menu->next) {
> -               if (sym && sym_is_choice(sym) &&
> -                   menu->sym && !sym_is_choice_value(menu->sym)) {
> -                       menu->sym->flags |= SYMBOL_CHOICEVAL;
> -               }
> -
>                 /*
>                  * This code serves two purposes:
>                  *
> diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
> index 3255bf310cb2..6c6f238c4f7b 100644
> --- a/scripts/kconfig/symbol.c
> +++ b/scripts/kconfig/symbol.c
> @@ -871,6 +871,11 @@ bool sym_is_changeable(const struct symbol *sym)
>         return !sym_is_choice(sym) && sym->visible > sym->rev_dep.tri;
>  }
>
> +bool sym_is_choice_value(const struct symbol *sym)
> +{
> +       return !list_empty(&sym->choice_link);
> +}
> +
>  HASHTABLE_DEFINE(sym_hashtable, SYMBOL_HASHSIZE);
>
>  struct symbol *sym_lookup(const char *name, int flags)
> @@ -908,6 +913,7 @@ struct symbol *sym_lookup(const char *name, int flags)
>         symbol->type = S_UNKNOWN;
>         symbol->flags = flags;
>         INIT_LIST_HEAD(&symbol->menus);
> +       INIT_LIST_HEAD(&symbol->choice_link);
>
>         hash_add(sym_hashtable, &symbol->node, hash);
>
> --
> 2.43.0
>
diff mbox series

Patch

diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index 54b008c0161d..6e47e0ad6e6e 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -131,7 +131,6 @@  struct symbol {
 
 #define SYMBOL_CONST      0x0001  /* symbol is const */
 #define SYMBOL_CHECK      0x0008  /* used during dependency checking */
-#define SYMBOL_CHOICEVAL  0x0020  /* used as a value in a choice block */
 #define SYMBOL_VALID      0x0080  /* set when symbol.curr is calculated */
 #define SYMBOL_WRITE      0x0200  /* write symbol to file (KCONFIG_CONFIG) */
 #define SYMBOL_WRITTEN    0x0800  /* track info to avoid double-write to .config */
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
index 6b50e25133e3..c0f46f189060 100644
--- a/scripts/kconfig/gconf.c
+++ b/scripts/kconfig/gconf.c
@@ -1070,7 +1070,7 @@  static gchar **fill_row(struct menu *menu)
 		row[COL_BTNVIS] = GINT_TO_POINTER(FALSE);
 		return row;
 	}
-	if (sym->flags & SYMBOL_CHOICEVAL)
+	if (sym_is_choice_value(sym))
 		row[COL_BTNRAD] = GINT_TO_POINTER(TRUE);
 
 	stype = sym_get_type(sym);
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index 3fa46610f25f..401bdf36323a 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -128,10 +128,7 @@  static inline bool sym_is_choice(const struct symbol *sym)
 	return sym->name == NULL;
 }
 
-static inline bool sym_is_choice_value(const struct symbol *sym)
-{
-	return sym->flags & SYMBOL_CHOICEVAL ? true : false;
-}
+bool sym_is_choice_value(const struct symbol *sym);
 
 static inline bool sym_has_value(const struct symbol *sym)
 {
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index 2a9b4c4f4428..cd34cc5aefcf 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -467,11 +467,6 @@  static void _menu_finalize(struct menu *parent, bool inside_choice)
 		sym->dir_dep.expr = expr_alloc_or(sym->dir_dep.expr, parent->dep);
 	}
 	for (menu = parent->list; menu; menu = menu->next) {
-		if (sym && sym_is_choice(sym) &&
-		    menu->sym && !sym_is_choice_value(menu->sym)) {
-			menu->sym->flags |= SYMBOL_CHOICEVAL;
-		}
-
 		/*
 		 * This code serves two purposes:
 		 *
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 3255bf310cb2..6c6f238c4f7b 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -871,6 +871,11 @@  bool sym_is_changeable(const struct symbol *sym)
 	return !sym_is_choice(sym) && sym->visible > sym->rev_dep.tri;
 }
 
+bool sym_is_choice_value(const struct symbol *sym)
+{
+	return !list_empty(&sym->choice_link);
+}
+
 HASHTABLE_DEFINE(sym_hashtable, SYMBOL_HASHSIZE);
 
 struct symbol *sym_lookup(const char *name, int flags)
@@ -908,6 +913,7 @@  struct symbol *sym_lookup(const char *name, int flags)
 	symbol->type = S_UNKNOWN;
 	symbol->flags = flags;
 	INIT_LIST_HEAD(&symbol->menus);
+	INIT_LIST_HEAD(&symbol->choice_link);
 
 	hash_add(sym_hashtable, &symbol->node, hash);