diff options
author | Andrew Morton <akpm@osdl.org> | 2004-03-18 15:00:47 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-03-18 15:00:47 -0800 |
commit | 5a87d187fce156e959beed81f287bdfb23128ae7 (patch) | |
tree | ff939715952b10a49e2912cd046bc69f51247339 /scripts | |
parent | 6fa4a50c4dab0067de5ce819c554e6ed21bce1b9 (diff) | |
download | history-5a87d187fce156e959beed81f287bdfb23128ae7.tar.gz |
[PATCH] config: choice fix
From: Roman Zippel <zippel@linux-m68k.org>
When a boolean choice value has a dependency of 'm' it can be shortly
treated as a tristate symbol. This fixes this and also add a small
optimization to precompute the value of the module symbol instead of
checking it all the time.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/kconfig/confdata.c | 2 | ||||
-rw-r--r-- | scripts/kconfig/symbol.c | 26 |
2 files changed, 15 insertions, 13 deletions
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index cf551c4b10125..90247d2e88ce0 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -229,6 +229,8 @@ int conf_read(const char *name) } fclose(in); + if (modules_sym) + sym_calc_value(modules_sym); for_all_symbols(i, sym) { sym_calc_value(sym); if (sym_has_value(sym) && !sym_is_choice_value(sym)) { diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index f5e3ad005c6f9..16b48cf883da1 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -31,6 +31,7 @@ struct symbol symbol_yes = { int sym_change_count; struct symbol *modules_sym; +tristate modules_val; void sym_add_default(struct symbol *sym, const char *def) { @@ -79,11 +80,8 @@ enum symbol_type sym_get_type(struct symbol *sym) if (type == S_TRISTATE) { if (sym_is_choice_value(sym) && sym->visible == yes) type = S_BOOLEAN; - else { - sym_calc_value(modules_sym); - if (modules_sym->curr.tri == no) - type = S_BOOLEAN; - } + else if (modules_val == no) + type = S_BOOLEAN; } return type; } @@ -153,6 +151,8 @@ static void sym_calc_visibility(struct symbol *sym) prop->visible.tri = expr_calc_value(prop->visible.expr); tri = E_OR(tri, prop->visible.tri); } + if (tri == mod && (sym->type != S_TRISTATE || modules_val == no)) + tri = yes; if (sym->visible != tri) { sym->visible = tri; sym_set_changed(sym); @@ -162,6 +162,8 @@ static void sym_calc_visibility(struct symbol *sym) tri = no; if (sym->rev_dep.expr) tri = expr_calc_value(sym->rev_dep.expr); + if (tri == mod && sym_get_type(sym) == S_BOOLEAN) + tri = yes; if (sym->rev_dep.tri != tri) { sym->rev_dep.tri = tri; sym_set_changed(sym); @@ -268,14 +270,8 @@ void sym_calc_value(struct symbol *sym) newval.tri = expr_calc_value(prop->expr); } } - if (sym_get_type(sym) == S_BOOLEAN) { - if (newval.tri == mod) - newval.tri = yes; - if (sym->visible == mod) - sym->visible = yes; - if (sym->rev_dep.tri == mod) - sym->rev_dep.tri = yes; - } + if (newval.tri == mod && sym_get_type(sym) == S_BOOLEAN) + newval.tri = yes; break; case S_STRING: case S_HEX: @@ -307,6 +303,8 @@ void sym_calc_value(struct symbol *sym) if (memcmp(&oldval, &sym->curr, sizeof(oldval))) sym_set_changed(sym); + if (modules_sym == sym) + modules_val = modules_sym->curr.tri; if (sym_is_choice(sym)) { int flags = sym->flags & (SYMBOL_CHANGED | SYMBOL_WRITE); @@ -327,6 +325,8 @@ void sym_clear_all_valid(void) for_all_symbols(i, sym) sym->flags &= ~SYMBOL_VALID; sym_change_count++; + if (modules_sym) + sym_calc_value(modules_sym); } void sym_set_changed(struct symbol *sym) |