From c8c1b332d031c5837335fb680ed56bd6cc70e57b Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sat, 31 Jul 2010 23:35:32 +0200 Subject: [PATCH] --- yaml --- r: 204855 b: refs/heads/master c: c252147de68cf58ba601278481e473dab432cee4 h: refs/heads/master i: 204853: 8f0faa03122d14377c031ef33dd25e865a736303 204851: 35aee83faab3e2e3aafd0658399b23e4d6ecb201 204847: 6c65089671c2967509d838b283e133ed1fe7ffd4 v: v3 --- [refs] | 2 +- trunk/scripts/kconfig/lkc.h | 1 + trunk/scripts/kconfig/symbol.c | 46 ++++++++++++++++++++++++---------- 3 files changed, 35 insertions(+), 14 deletions(-) diff --git a/[refs] b/[refs] index 010c997670ec..eab0c5696619 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 0748cb3e1fbd89c03a98c15e91ad65797981de77 +refs/heads/master: c252147de68cf58ba601278481e473dab432cee4 diff --git a/trunk/scripts/kconfig/lkc.h b/trunk/scripts/kconfig/lkc.h index ce6549cdaccf..755b8190eb64 100644 --- a/trunk/scripts/kconfig/lkc.h +++ b/trunk/scripts/kconfig/lkc.h @@ -126,6 +126,7 @@ void sym_init(void); void sym_clear_all_valid(void); void sym_set_all_changed(void); void sym_set_changed(struct symbol *sym); +struct symbol *sym_choice_default(struct symbol *sym); struct symbol *sym_check_deps(struct symbol *sym); struct property *prop_alloc(enum prop_type type, struct symbol *sym); struct symbol *prop_get_symbol(struct property *prop); diff --git a/trunk/scripts/kconfig/symbol.c b/trunk/scripts/kconfig/symbol.c index bc1e1584e2da..0a013ab3ae27 100644 --- a/trunk/scripts/kconfig/symbol.c +++ b/trunk/scripts/kconfig/symbol.c @@ -226,22 +226,18 @@ static void sym_calc_visibility(struct symbol *sym) } } -static struct symbol *sym_calc_choice(struct symbol *sym) +/* + * Find the default symbol for a choice. + * First try the default values for the choice symbol + * Next locate the first visible choice value + * Return NULL if none was found + */ +struct symbol *sym_choice_default(struct symbol *sym) { struct symbol *def_sym; struct property *prop; struct expr *e; - /* first calculate all choice values' visibilities */ - prop = sym_get_choice_prop(sym); - expr_list_for_each_sym(prop->expr, e, def_sym) - sym_calc_visibility(def_sym); - - /* is the user choice visible? */ - def_sym = sym->def[S_DEF_USER].val; - if (def_sym && def_sym->visible != no) - return def_sym; - /* any of the defaults visible? */ for_all_defaults(sym, prop) { prop->visible.tri = expr_calc_value(prop->visible.expr); @@ -258,11 +254,35 @@ static struct symbol *sym_calc_choice(struct symbol *sym) if (def_sym->visible != no) return def_sym; - /* no choice? reset tristate value */ - sym->curr.tri = no; + /* failed to locate any defaults */ return NULL; } +static struct symbol *sym_calc_choice(struct symbol *sym) +{ + struct symbol *def_sym; + struct property *prop; + struct expr *e; + + /* first calculate all choice values' visibilities */ + prop = sym_get_choice_prop(sym); + expr_list_for_each_sym(prop->expr, e, def_sym) + sym_calc_visibility(def_sym); + + /* is the user choice visible? */ + def_sym = sym->def[S_DEF_USER].val; + if (def_sym && def_sym->visible != no) + return def_sym; + + def_sym = sym_choice_default(sym); + + if (def_sym == NULL) + /* no choice? reset tristate value */ + sym->curr.tri = no; + + return def_sym; +} + void sym_calc_value(struct symbol *sym) { struct symbol_value newval, oldval;