Commit fb1e1518 authored by Roman Zippel's avatar Roman Zippel Committed by Linus Torvalds

[PATCH] restore old config behaviour for dependencies on 'm'

This restores the old config behaviour for dependencies on 'm',
such entries are only activ if CONFIG_MODULES is enabled as well.
parent 0deb87aa
...@@ -54,9 +54,34 @@ void menu_end_menu(void) ...@@ -54,9 +54,34 @@ void menu_end_menu(void)
current_menu = current_menu->parent; current_menu = current_menu->parent;
} }
struct expr *menu_check_dep(struct expr *e)
{
if (!e)
return e;
switch (e->type) {
case E_NOT:
e->left.expr = menu_check_dep(e->left.expr);
break;
case E_OR:
case E_AND:
e->left.expr = menu_check_dep(e->left.expr);
e->right.expr = menu_check_dep(e->right.expr);
break;
case E_SYMBOL:
/* change 'm' into 'm' && MODULES */
if (e->left.sym == &symbol_mod)
return expr_alloc_and(e, expr_alloc_symbol(modules_sym));
break;
default:
break;
}
return e;
}
void menu_add_dep(struct expr *dep) void menu_add_dep(struct expr *dep)
{ {
current_entry->dep = expr_alloc_and(current_entry->dep, dep); current_entry->dep = expr_alloc_and(current_entry->dep, menu_check_dep(dep));
} }
void menu_set_type(int type) void menu_set_type(int type)
...@@ -96,7 +121,7 @@ struct property *menu_add_prop(int token, char *prompt, struct symbol *def, stru ...@@ -96,7 +121,7 @@ struct property *menu_add_prop(int token, char *prompt, struct symbol *def, stru
prop->menu = current_entry; prop->menu = current_entry;
prop->text = prompt; prop->text = prompt;
prop->def = def; prop->def = def;
E_EXPR(prop->visible) = dep; E_EXPR(prop->visible) = menu_check_dep(dep);
if (prompt) if (prompt)
current_entry->prompt = prop; current_entry->prompt = prop;
......
...@@ -1726,12 +1726,14 @@ yyreturn: ...@@ -1726,12 +1726,14 @@ yyreturn:
void conf_parse(const char *name) void conf_parse(const char *name)
{ {
zconf_initscan(name); zconf_initscan(name);
sym_init(); sym_init();
menu_init(); menu_init();
modules_sym = sym_lookup("MODULES", 0);
rootmenu.prompt = menu_add_prop(P_MENU, "Linux Kernel Configuration", NULL, NULL); rootmenu.prompt = menu_add_prop(P_MENU, "Linux Kernel Configuration", NULL, NULL);
//zconfdebug = 1; //zconfdebug = 1;
...@@ -1740,8 +1742,6 @@ void conf_parse(const char *name) ...@@ -1740,8 +1742,6 @@ void conf_parse(const char *name)
exit(1); exit(1);
menu_finalize(&rootmenu); menu_finalize(&rootmenu);
modules_sym = sym_lookup("MODULES", 0);
sym_change_count = 1; sym_change_count = 1;
} }
......
...@@ -423,6 +423,7 @@ void conf_parse(const char *name) ...@@ -423,6 +423,7 @@ void conf_parse(const char *name)
sym_init(); sym_init();
menu_init(); menu_init();
modules_sym = sym_lookup("MODULES", 0);
rootmenu.prompt = menu_add_prop(P_MENU, "Linux Kernel Configuration", NULL, NULL); rootmenu.prompt = menu_add_prop(P_MENU, "Linux Kernel Configuration", NULL, NULL);
//zconfdebug = 1; //zconfdebug = 1;
...@@ -431,8 +432,6 @@ void conf_parse(const char *name) ...@@ -431,8 +432,6 @@ void conf_parse(const char *name)
exit(1); exit(1);
menu_finalize(&rootmenu); menu_finalize(&rootmenu);
modules_sym = sym_lookup("MODULES", 0);
sym_change_count = 1; sym_change_count = 1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment