aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2008-01-24 06:54:23 -0500
committerSam Ravnborg <sam@ravnborg.org>2008-01-28 17:21:18 -0500
commitf5eaa323eb6819d2f737ead42464efccaf2b98b9 (patch)
tree2ea709d5fd82bff86103607d285106f5bb71f64f /scripts
parent1a3fb6d481689d0482eacadcbe3205b49b423c11 (diff)
kconfig: tristate choices with mixed tristate and boolean values
Change kconfig behavior so that mixing bool and tristate config settings in a choice is possible and has the desired effect of offering just the tristate options individually if the choice gets set to M, and a normal boolean selection if the choice gets set to Y. Also fix scripts/kconfig/conf's handling of children of choice values - there may be more than one immediate child, and all of them need to be processed. Signed-off-by: Jan Beulich <jbeulich@novell.com> Cc: "Roman Zippel" <zippel@linux-m68k.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/kconfig/conf.c4
-rw-r--r--scripts/kconfig/expr.c10
-rw-r--r--scripts/kconfig/menu.c38
3 files changed, 45 insertions, 7 deletions
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index d1a0368bd438..fda63136ae68 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -400,9 +400,9 @@ static int conf_choice(struct menu *menu)
400 continue; 400 continue;
401 } 401 }
402 sym_set_choice_value(sym, child->sym); 402 sym_set_choice_value(sym, child->sym);
403 if (child->list) { 403 for (child = child->list; child; child = child->next) {
404 indent += 2; 404 indent += 2;
405 conf(child->list); 405 conf(child);
406 indent -= 2; 406 indent -= 2;
407 } 407 }
408 return 1; 408 return 1;
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c
index 13788ada5228..579ece4fa584 100644
--- a/scripts/kconfig/expr.c
+++ b/scripts/kconfig/expr.c
@@ -1034,12 +1034,18 @@ void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *
1034 expr_print(e->left.expr, fn, data, E_NOT); 1034 expr_print(e->left.expr, fn, data, E_NOT);
1035 break; 1035 break;
1036 case E_EQUAL: 1036 case E_EQUAL:
1037 fn(data, e->left.sym, e->left.sym->name); 1037 if (e->left.sym->name)
1038 fn(data, e->left.sym, e->left.sym->name);
1039 else
1040 fn(data, NULL, "<choice>");
1038 fn(data, NULL, "="); 1041 fn(data, NULL, "=");
1039 fn(data, e->right.sym, e->right.sym->name); 1042 fn(data, e->right.sym, e->right.sym->name);
1040 break; 1043 break;
1041 case E_UNEQUAL: 1044 case E_UNEQUAL:
1042 fn(data, e->left.sym, e->left.sym->name); 1045 if (e->left.sym->name)
1046 fn(data, e->left.sym, e->left.sym->name);
1047 else
1048 fn(data, NULL, "<choice>");
1043 fn(data, NULL, "!="); 1049 fn(data, NULL, "!=");
1044 fn(data, e->right.sym, e->right.sym->name); 1050 fn(data, e->right.sym, e->right.sym->name);
1045 break; 1051 break;
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index e6ef171e5b14..fdad17367f61 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -242,9 +242,11 @@ void menu_finalize(struct menu *parent)
242 for (menu = parent->list; menu; menu = menu->next) { 242 for (menu = parent->list; menu; menu = menu->next) {
243 if (menu->sym) { 243 if (menu->sym) {
244 current_entry = parent; 244 current_entry = parent;
245 menu_set_type(menu->sym->type); 245 if (sym->type == S_UNKNOWN)
246 menu_set_type(menu->sym->type);
246 current_entry = menu; 247 current_entry = menu;
247 menu_set_type(sym->type); 248 if (menu->sym->type == S_UNKNOWN)
249 menu_set_type(sym->type);
248 break; 250 break;
249 } 251 }
250 } 252 }
@@ -329,7 +331,37 @@ void menu_finalize(struct menu *parent)
329 "values not supported"); 331 "values not supported");
330 } 332 }
331 current_entry = menu; 333 current_entry = menu;
332 menu_set_type(sym->type); 334 if (menu->sym->type == S_UNKNOWN)
335 menu_set_type(sym->type);
336 /* Non-tristate choice values of tristate choices must
337 * depend on the choice being set to Y. The choice
338 * values' dependencies were propagated to their
339 * properties above, so the change here must be re-
340 * propagated. */
341 if (sym->type == S_TRISTATE && menu->sym->type != S_TRISTATE) {
342 basedep = expr_alloc_comp(E_EQUAL, sym, &symbol_yes);
343 basedep = expr_alloc_and(basedep, menu->dep);
344 basedep = expr_eliminate_dups(basedep);
345 menu->dep = basedep;
346 for (prop = menu->sym->prop; prop; prop = prop->next) {
347 if (prop->menu != menu)
348 continue;
349 dep = expr_alloc_and(expr_copy(basedep),
350 prop->visible.expr);
351 dep = expr_eliminate_dups(dep);
352 dep = expr_trans_bool(dep);
353 prop->visible.expr = dep;
354 if (prop->type == P_SELECT) {
355 struct symbol *es = prop_get_symbol(prop);
356 dep2 = expr_alloc_symbol(menu->sym);
357 dep = expr_alloc_and(dep2,
358 expr_copy(dep));
359 dep = expr_alloc_or(es->rev_dep.expr, dep);
360 dep = expr_eliminate_dups(dep);
361 es->rev_dep.expr = dep;
362 }
363 }
364 }
333 menu_add_symbol(P_CHOICE, sym, NULL); 365 menu_add_symbol(P_CHOICE, sym, NULL);
334 prop = sym_get_choice_prop(sym); 366 prop = sym_get_choice_prop(sym);
335 for (ep = &prop->expr; *ep; ep = &(*ep)->left.expr) 367 for (ep = &prop->expr; *ep; ep = &(*ep)->left.expr)