Skip to contentSkip to conversation

Kconfig: add disable command.

PATCH In review Martin Schwidefsky 1 participant 1 message Sep 5, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/5 Kconfig: add disable command.

From: Martin Schwidefsky <[email protected]>

[patch 2/5] Kconfig: add disable command.

This patch adds the "disable <name> [if <expr>]" Kconfig command. The purpose of the command is to allow architectures to disable specific configuration options. For example "disable GEN_RTC" will disable the GEN_RTC option, "disable RTC if !EXPERIMENTAL" will disable the RTC option if the EXPERIMENTAL option is not selected.

---

 scripts/kconfig/expr.h               |    3 
 scripts/kconfig/menu.c               |    8 
 scripts/kconfig/zconf.gperf          |    1 
 scripts/kconfig/zconf.hash.c_shipped |  121 +++---
 scripts/kconfig/zconf.tab.c_shipped  |  606 ++++++++++++++++++-----------------
 scripts/kconfig/zconf.y              |   22 +
 6 files changed, 409 insertions(+), 352 deletions(-)
scripts/kconfig/expr.h +2 -1
diff -urpN linux-2.6/scripts/kconfig/expr.h linux-2.6-patched/scripts/kconfig/expr.h
@@ -78,7 +78,8 @@ struct symbol {
 	tristate visible;
 	int flags;
 	struct property *prop;
-	struct expr *dep, *dep2;
+	struct expr *disable;
+	struct menu *menu;
 	struct expr_value rev_dep;
 };
 
scripts/kconfig/menu.c +8 -0
diff -urpN linux-2.6/scripts/kconfig/menu.c linux-2.6-patched/scripts/kconfig/menu.c
@@ -59,6 +59,14 @@ void menu_add_entry(struct symbol *sym)
 
 void menu_end_entry(void)
 {
+	struct expr *dep;
+	if (!current_entry->sym)
+		return;
+	current_entry->sym->menu = current_entry;
+	if (!current_entry->sym->disable)
+		return;
+	dep = expr_alloc_one(E_NOT, current_entry->sym->disable);
+	current_entry->dep = expr_alloc_and(current_entry->dep, dep);
 }
 
 struct menu *menu_add_menu(void)
scripts/kconfig/zconf.gperf +1 -0
diff -urpN linux-2.6/scripts/kconfig/zconf.gperf linux-2.6-patched/scripts/kconfig/zconf.gperf
@@ -43,4 +43,5 @@ option,		T_OPTION,	TF_COMMAND
 on,		T_ON,		TF_PARAM
 modules,	T_OPT_MODULES,	TF_OPTION
 defconfig_list,	T_OPT_DEFCONFIG_LIST,TF_OPTION
+disable,	T_DISABLE,	TF_COMMAND
 %%
scripts/kconfig/zconf.hash.c_shipped +62 -59

207 lines not on this page · raw message

scripts/kconfig/zconf.tab.c_shipped +315 -291

1,001 lines not on this page · raw message

scripts/kconfig/zconf.y +21 -1
diff -urpN linux-2.6/scripts/kconfig/zconf.y linux-2.6-patched/scripts/kconfig/zconf.y
@@ -1,4 +1,4 @@
-%{
+{
 /*
  * Copyright (C) 2002 Roman Zippel <[email protected]>
  * Released under the terms of the GNU GPL v2.0.
@@ -73,6 +73,7 @@ static struct menu *current_menu, *curre
 %token <id>T_RANGE
 %token <id>T_OPTION
 %token <id>T_ON
+%token <id>T_DISABLE
 %token <string> T_WORD
 %token <string> T_WORD_QUOTE
 %token T_UNEQUAL
@@ -130,6 +131,7 @@ common_stmt:
 	| config_stmt
 	| menuconfig_stmt
 	| source_stmt
+	| disable_stmt
 ;
 
 option_error:
@@ -470,6 +472,24 @@ symbol:	  T_WORD	{ $$ = sym_lookup($1, 0
 	| T_WORD_QUOTE	{ $$ = sym_lookup($1, 1); free($1); }
 ;
 
+/* disable option */
+
+disable_stmt: T_DISABLE T_WORD if_expr T_EOL
+{
+	struct symbol *sym = sym_lookup($2, 0);
+	struct expr *dep;
+
+	dep = $3;
+	if (!dep)
+		dep = expr_alloc_symbol(&symbol_yes);
+	sym->disable = expr_alloc_and(sym->disable, dep);
+	if (sym->menu) {
+		dep = expr_alloc_one(E_NOT, sym->disable);
+		sym->menu->dep = expr_alloc_and(sym->menu->dep, dep);
+	}
+	printd(DEBUG_PARSE, "%s:%d:disable\n", zconf_curname(), zconf_lineno());
+};
+
 %%
 
 void conf_parse(const char *name)