mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-15 13:15:57 +00:00
kconfig: refactor code in symbol.c
Move logic to determine default for a choice to a separate function. No functional changes. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
This commit is contained in:
parent
0748cb3e1f
commit
c252147de6
@ -126,6 +126,7 @@ void sym_init(void);
|
|||||||
void sym_clear_all_valid(void);
|
void sym_clear_all_valid(void);
|
||||||
void sym_set_all_changed(void);
|
void sym_set_all_changed(void);
|
||||||
void sym_set_changed(struct symbol *sym);
|
void sym_set_changed(struct symbol *sym);
|
||||||
|
struct symbol *sym_choice_default(struct symbol *sym);
|
||||||
struct symbol *sym_check_deps(struct symbol *sym);
|
struct symbol *sym_check_deps(struct symbol *sym);
|
||||||
struct property *prop_alloc(enum prop_type type, struct symbol *sym);
|
struct property *prop_alloc(enum prop_type type, struct symbol *sym);
|
||||||
struct symbol *prop_get_symbol(struct property *prop);
|
struct symbol *prop_get_symbol(struct property *prop);
|
||||||
|
@ -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 symbol *def_sym;
|
||||||
struct property *prop;
|
struct property *prop;
|
||||||
struct expr *e;
|
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? */
|
/* any of the defaults visible? */
|
||||||
for_all_defaults(sym, prop) {
|
for_all_defaults(sym, prop) {
|
||||||
prop->visible.tri = expr_calc_value(prop->visible.expr);
|
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)
|
if (def_sym->visible != no)
|
||||||
return def_sym;
|
return def_sym;
|
||||||
|
|
||||||
/* no choice? reset tristate value */
|
/* failed to locate any defaults */
|
||||||
sym->curr.tri = no;
|
|
||||||
return NULL;
|
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)
|
void sym_calc_value(struct symbol *sym)
|
||||||
{
|
{
|
||||||
struct symbol_value newval, oldval;
|
struct symbol_value newval, oldval;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user