Skip to contentSkip to conversation

kconfig: remove SYMBOL_NO_WRITE flag

PATCH In review Masahiro Yamada 1 participant 2 messages Apr 27, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kconfig: remove SYMBOL_NO_WRITE flag

This flag is set to symbols that are not intended to be written to the .config file.

Since commit b75b0a819af9 ("kconfig: change defconfig_list option to environment variable"), SYMBOL_NO_WRITE is only set to choices.

Therefore, (sym->flags & SYMBOL_NO_WRITE) is equivalent to sym_is_choice(sym). This flags is no longer necessary.

---

 scripts/kconfig/confdata.c | 4 ++--
 scripts/kconfig/expr.h     | 1 -
 scripts/kconfig/gconf.c    | 2 --
 scripts/kconfig/parser.y   | 2 +-
 scripts/kconfig/symbol.c   | 3 +--
 5 files changed, 4 insertions(+), 8 deletions(-)
scripts/kconfig/confdata.c +2 -2
index bcce87658998..5caec434e6f4 100644
@@ -502,7 +502,7 @@ int conf_read(const char *name)
 
 	for_all_symbols(sym) {
 		sym_calc_value(sym);
-		if (sym_is_choice(sym) || (sym->flags & SYMBOL_NO_WRITE))
+		if (sym_is_choice(sym))
 			continue;
 		if (sym_has_value(sym) && (sym->flags & SYMBOL_WRITE)) {
 			/* check that calculated value agrees with saved value */
@@ -1007,7 +1007,7 @@ static int conf_touch_deps(void)
 
 	for_all_symbols(sym) {
 		sym_calc_value(sym);
-		if ((sym->flags & SYMBOL_NO_WRITE) || !sym->name)
+		if (sym_is_choice(sym))
 			continue;
 		if (sym->flags & SYMBOL_WRITE) {
 			if (sym->flags & SYMBOL_DEF_AUTO) {
scripts/kconfig/expr.h +0 -1
index f646a98de006..d965e427753e 100644
@@ -135,7 +135,6 @@ struct symbol {
 #define SYMBOL_WRITE      0x0200  /* write symbol to file (KCONFIG_CONFIG) */
 #define SYMBOL_CHANGED    0x0400  /* ? */
 #define SYMBOL_WRITTEN    0x0800  /* track info to avoid double-write to .config */
-#define SYMBOL_NO_WRITE   0x1000  /* Symbol for internal use only; it will not be written */
 #define SYMBOL_CHECKED    0x2000  /* used during dependency checking */
 #define SYMBOL_WARNED     0x8000  /* warning has been issued */
 
scripts/kconfig/gconf.c +0 -2
index 13e2449ac83f..67a27c497c40 100644
@@ -91,8 +91,6 @@ static const char *dbg_sym_flags(int val)
 		strcat(buf, "write/");
 	if (val & SYMBOL_CHANGED)
 		strcat(buf, "changed/");
-	if (val & SYMBOL_NO_WRITE)
-		strcat(buf, "no_write/");
 
 	buf[strlen(buf) - 1] = '\0';
 
scripts/kconfig/parser.y +1 -1
index 69dc0c098acb..613fa8c9c2d0 100644
@@ -222,7 +222,7 @@ config_option: T_MODULES T_EOL
 choice: T_CHOICE T_EOL
 {
 	struct symbol *sym = sym_lookup(NULL, 0);
-	sym->flags |= SYMBOL_NO_WRITE;
+
 	menu_add_entry(sym);
 	menu_add_expr(P_CHOICE, NULL, NULL);
 	printd(DEBUG_PARSE, "%s:%d:choice\n", cur_filename, cur_lineno);
scripts/kconfig/symbol.c +1 -2
index 8b34992ba5ed..b909c64f3bac 100644
@@ -466,10 +466,9 @@ void sym_calc_value(struct symbol *sym)
 			if (sym->flags & SYMBOL_CHANGED)
 				sym_set_changed(choice_sym);
 		}
-	}
 
-	if (sym->flags & SYMBOL_NO_WRITE)
 		sym->flags &= ~SYMBOL_WRITE;
+	}
 
 	if (sym->flags & SYMBOL_NEED_SET_CHOICE_VALUES)
 		set_all_choice_values(sym);
Signature · 1 line
2.40.1
#1 lore raw
Quoted 9 lines · Masahiro Yamada

This flag is set to symbols that are not intended to be written to the .config file.

Since commit b75b0a819af9 ("kconfig: change defconfig_list option to environment variable"), SYMBOL_NO_WRITE is only set to choices.

Therefore, (sym->flags & SYMBOL_NO_WRITE) is equivalent to sym_is_choice(sym). This flags is no longer necessary.

"This flags" -> "This flag"

Quoted 90 lines

---

 scripts/kconfig/confdata.c | 4 ++--
 scripts/kconfig/expr.h     | 1 -
 scripts/kconfig/gconf.c    | 2 --
 scripts/kconfig/parser.y   | 2 +-
 scripts/kconfig/symbol.c   | 3 +--
 5 files changed, 4 insertions(+), 8 deletions(-)
scripts/kconfig/confdata.c +2 -2
index bcce87658998..5caec434e6f4 100644
@@ -502,7 +502,7 @@ int conf_read(const char *name)
 
        for_all_symbols(sym) {
                sym_calc_value(sym);
-               if (sym_is_choice(sym) || (sym->flags & SYMBOL_NO_WRITE))
+               if (sym_is_choice(sym))
                        continue;
                if (sym_has_value(sym) && (sym->flags & SYMBOL_WRITE)) {
                        /* check that calculated value agrees with saved value */
@@ -1007,7 +1007,7 @@ static int conf_touch_deps(void)
 
        for_all_symbols(sym) {
                sym_calc_value(sym);
-               if ((sym->flags & SYMBOL_NO_WRITE) || !sym->name)
+               if (sym_is_choice(sym))
                        continue;
                if (sym->flags & SYMBOL_WRITE) {
                        if (sym->flags & SYMBOL_DEF_AUTO) {
scripts/kconfig/expr.h +0 -1
index f646a98de006..d965e427753e 100644
@@ -135,7 +135,6 @@ struct symbol {
 #define SYMBOL_WRITE      0x0200  /* write symbol to file (KCONFIG_CONFIG) */
 #define SYMBOL_CHANGED    0x0400  /* ? */
 #define SYMBOL_WRITTEN    0x0800  /* track info to avoid double-write to .config */
-#define SYMBOL_NO_WRITE   0x1000  /* Symbol for internal use only; it will not be written */
 #define SYMBOL_CHECKED    0x2000  /* used during dependency checking */
 #define SYMBOL_WARNED     0x8000  /* warning has been issued */
 
scripts/kconfig/gconf.c +0 -2
index 13e2449ac83f..67a27c497c40 100644
@@ -91,8 +91,6 @@ static const char *dbg_sym_flags(int val)
                strcat(buf, "write/");
        if (val & SYMBOL_CHANGED)
                strcat(buf, "changed/");
-       if (val & SYMBOL_NO_WRITE)
-               strcat(buf, "no_write/");
 
        buf[strlen(buf) - 1] = '\0';
 
scripts/kconfig/parser.y +1 -1
index 69dc0c098acb..613fa8c9c2d0 100644
@@ -222,7 +222,7 @@ config_option: T_MODULES T_EOL
 choice: T_CHOICE T_EOL
 {
        struct symbol *sym = sym_lookup(NULL, 0);
-       sym->flags |= SYMBOL_NO_WRITE;
+
        menu_add_entry(sym);
        menu_add_expr(P_CHOICE, NULL, NULL);
        printd(DEBUG_PARSE, "%s:%d:choice\n", cur_filename, cur_lineno);
scripts/kconfig/symbol.c +1 -3
index 8b34992ba5ed..b909c64f3bac 100644
@@ -466,10 +466,9 @@ void sym_calc_value(struct symbol *sym)
                        if (sym->flags & SYMBOL_CHANGED)
                                sym_set_changed(choice_sym);
                }
-       }
 
-       if (sym->flags & SYMBOL_NO_WRITE)
                sym->flags &= ~SYMBOL_WRITE;
+       }
 
        if (sym->flags & SYMBOL_NEED_SET_CHOICE_VALUES)
                set_all_choice_values(sym);
--

2.40.1

Signature · 2 lines
Best Regards
Masahiro Yamada