From 677f5830588749cbb0bdb0568cbdaba271937c8d Mon Sep 17 00:00:00 2001 From: Dirk Gouders Date: Wed, 30 Oct 2013 15:06:05 +0100 Subject: [PATCH 2/2] kconfig/symbol.c: handle visibility of choice_values that depend on 'm' symbols If choice_values depend on symbols that are set to 'm' then these choice_values should not be visible in choice lists if the choice symbol is set to 'y'. See USB Gadget Drivers, for example. Reported-by: Sebastian Andrzej Siewior Signed-of-by: Dirk Gouders --- scripts/kconfig/symbol.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index 043c041..fbabb80 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -189,12 +189,23 @@ static void sym_validate_range(struct symbol *sym) static void sym_calc_visibility(struct symbol *sym) { struct property *prop; + struct symbol *choice_sym = NULL; tristate tri; /* any prompt visible? */ tri = no; + + if (sym_is_choice_value(sym)) + choice_sym = prop_get_symbol(sym_get_choice_prop(sym)); + for_all_prompts(sym, prop) { prop->visible.tri = expr_calc_value(prop->visible.expr); + /* + * choice_values with visibility 'mod' are not visible if the + * corresponding choice's value is 'yes'. + */ + if (prop->visible.tri == mod && (choice_sym != NULL && choice_sym->curr.tri == yes)) + prop->visible.tri = no; tri = EXPR_OR(tri, prop->visible.tri); } if (tri == mod && (sym->type != S_TRISTATE || modules_val == no)) -- 1.8.3.2