aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/menu.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/kconfig/menu.c')
-rw-r--r--scripts/kconfig/menu.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index 7e83aef42c6d..5f77dcb8977e 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -140,6 +140,20 @@ struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *e
140 } 140 }
141 if (current_entry->prompt && current_entry != &rootmenu) 141 if (current_entry->prompt && current_entry != &rootmenu)
142 prop_warn(prop, "prompt redefined"); 142 prop_warn(prop, "prompt redefined");
143
144 /* Apply all upper menus' visibilities to actual prompts. */
145 if(type == P_PROMPT) {
146 struct menu *menu = current_entry;
147
148 while ((menu = menu->parent) != NULL) {
149 if (!menu->visibility)
150 continue;
151 prop->visible.expr
152 = expr_alloc_and(prop->visible.expr,
153 menu->visibility);
154 }
155 }
156
143 current_entry->prompt = prop; 157 current_entry->prompt = prop;
144 } 158 }
145 prop->text = prompt; 159 prop->text = prompt;
@@ -152,6 +166,12 @@ struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr
152 return menu_add_prop(type, prompt, NULL, dep); 166 return menu_add_prop(type, prompt, NULL, dep);
153} 167}
154 168
169void menu_add_visibility(struct expr *expr)
170{
171 current_entry->visibility = expr_alloc_and(current_entry->visibility,
172 expr);
173}
174
155void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep) 175void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep)
156{ 176{
157 menu_add_prop(type, NULL, expr, dep); 177 menu_add_prop(type, NULL, expr, dep);
@@ -410,6 +430,11 @@ bool menu_is_visible(struct menu *menu)
410 if (!menu->prompt) 430 if (!menu->prompt)
411 return false; 431 return false;
412 432
433 if (menu->visibility) {
434 if (expr_calc_value(menu->visibility) == no)
435 return no;
436 }
437
413 sym = menu->sym; 438 sym = menu->sym;
414 if (sym) { 439 if (sym) {
415 sym_calc_value(sym); 440 sym_calc_value(sym);