aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorRoman Zippel <zippel@linux-m68k.org>2008-02-11 15:13:47 -0500
committerSam Ravnborg <sam@ravnborg.org>2008-02-13 16:30:09 -0500
commit587c90616a5b44e6ccfac38e64d4fecee51d588c (patch)
treedf2f7792304500f75c089f0d710e7977fc267bab /scripts
parent10270d4838bdc493781f5a1cf2e90e9c34c9142f (diff)
kconfig: fix select in combination with default
> The attached .config (with current -git) results in a compile > error since it contains: > > CONFIG_X86=y > # CONFIG_EMBEDDED is not set > CONFIG_SERIO=m > CONFIG_SERIO_I8042=y > > Looking at drivers/input/serio/Kconfig I simply don't get how this > can happen. You've hit the rather subtle rules of select vs default. What happened is that SERIO is selected to m, but SERIO_I8042 isn't selected so the default of y is used instead. We already had the problem in the past that select and default don't work well together, so this patch cleans this up and makes the rule hopefully more straightforward. Basically now the value is calculated like this: (value && dependency) || select where the value is the user choice (if available and the symbol is visible) or default. In this case it means SERIO and SERIO_I8042 are both set to y due to their default and if SERIO didn't had the default, then the SERIO_I8042 value would be limited to m due to the dependency. I tested this patch with more 10000 random configs and above case is the only the difference that showed up, so I hope there is nothing that depended on the old more complex and subtle rules. Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Tested-by: Adrian Bunk <bunk@kernel.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/kconfig/symbol.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 3929e5b35e79..4a03191ad176 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -298,22 +298,30 @@ void sym_calc_value(struct symbol *sym)
298 if (sym_is_choice_value(sym) && sym->visible == yes) { 298 if (sym_is_choice_value(sym) && sym->visible == yes) {
299 prop = sym_get_choice_prop(sym); 299 prop = sym_get_choice_prop(sym);
300 newval.tri = (prop_get_symbol(prop)->curr.val == sym) ? yes : no; 300 newval.tri = (prop_get_symbol(prop)->curr.val == sym) ? yes : no;
301 } else if (EXPR_OR(sym->visible, sym->rev_dep.tri) != no) { 301 } else {
302 sym->flags |= SYMBOL_WRITE; 302 if (sym->visible != no) {
303 if (sym_has_value(sym)) 303 /* if the symbol is visible use the user value
304 newval.tri = sym->def[S_DEF_USER].tri; 304 * if available, otherwise try the default value
305 else if (!sym_is_choice(sym)) { 305 */
306 prop = sym_get_default_prop(sym); 306 sym->flags |= SYMBOL_WRITE;
307 if (prop) 307 if (sym_has_value(sym)) {
308 newval.tri = expr_calc_value(prop->expr); 308 newval.tri = EXPR_AND(sym->def[S_DEF_USER].tri,
309 sym->visible);
310 goto calc_newval;
311 }
309 } 312 }
310 newval.tri = EXPR_OR(EXPR_AND(newval.tri, sym->visible), sym->rev_dep.tri); 313 if (sym->rev_dep.tri != no)
311 } else if (!sym_is_choice(sym)) {
312 prop = sym_get_default_prop(sym);
313 if (prop) {
314 sym->flags |= SYMBOL_WRITE; 314 sym->flags |= SYMBOL_WRITE;
315 newval.tri = expr_calc_value(prop->expr); 315 if (!sym_is_choice(sym)) {
316 prop = sym_get_default_prop(sym);
317 if (prop) {
318 sym->flags |= SYMBOL_WRITE;
319 newval.tri = EXPR_AND(expr_calc_value(prop->expr),
320 prop->visible.tri);
321 }
316 } 322 }
323 calc_newval:
324 newval.tri = EXPR_OR(newval.tri, sym->rev_dep.tri);
317 } 325 }
318 if (newval.tri == mod && sym_get_type(sym) == S_BOOLEAN) 326 if (newval.tri == mod && sym_get_type(sym) == S_BOOLEAN)
319 newval.tri = yes; 327 newval.tri = yes;