kconfig: add module_name shortcut
Subsystems (3)
PATCH 12/13 kconfig: add module_name shortcut
From: Alexey Dobriyan <[email protected]>
As correctly noticed in bug 11446
(http://bugzilla.kernel.org/show_bug.cgi?id=11446) "To compile this driver as a module, blah-blah" boilerplate is being copy-pasted to death with slight variations.
Add Kconfig token "module_name" to supply module's name. Example:
config FOO tristate "foo" module_name foo ---help--- foo
Print module's name as following on menuconfigs help screen (press 'h'):
Module name: foo
8139too driver converted to show real-life example.
P.S.: menuconfig only, no checking wrt modular/standalone code et al.
---
drivers/net/Kconfig | 4 scripts/kconfig/expr.h | 4 scripts/kconfig/lkc.h | 1 scripts/kconfig/mconf.c | 2 scripts/kconfig/menu.c | 8 scripts/kconfig/symbol.c | 2 scripts/kconfig/zconf.gperf | 1 scripts/kconfig/zconf.hash.c_shipped | 184 ++++---- scripts/kconfig/zconf.tab.c_shipped | 539 ++++++++++++------------- scripts/kconfig/zconf.y | 12 10 files changed, 404 insertions(+), 353 deletions(-)
drivers/net/Kconfig renamed from drivers/net/Kconfig~kconfig-add-module_name-shortcut +1 -3
@@ -1549,14 +1549,12 @@ config 8139TOO depends on NET_PCI && PCI select CRC32 select MII + module_name 8139too ---help--- This is a driver for the Fast Ethernet PCI network cards based on the RTL 8129/8130/8139 chips. If you have one of those, say Y and read the Ethernet-HOWTO <http://www.tldp.org/docs.html#howto>. - To compile this driver as a module, choose M here: the module - will be called 8139too. This is recommended. - config 8139TOO_PIO bool "Use PIO instead of MMIO" default y
scripts/kconfig/expr.h renamed from scripts/kconfig/expr.h~kconfig-add-module_name-shortcut +3 -1
@@ -107,7 +107,8 @@ struct symbol {enum prop_type {P_UNKNOWN ,P_PROMPT ,P_COMMENT ,P_MENU ,P_DEFAULT ,P_CHOICE , -P_SELECT ,P_RANGE ,P_ENV +P_SELECT ,P_RANGE ,P_ENV , +P_MODULE_NAME , };struct property {
@@ -115,6 +116,7 @@ struct property {struct symbol *sym;enum prop_type type;const char *text; +char *module_name;struct expr_value visible;struct expr *expr;struct menu *menu;
scripts/kconfig/lkc.h renamed from scripts/kconfig/lkc.h~kconfig-add-module_name-shortcut +1 -0
@@ -95,6 +95,7 @@ struct property *menu_add_prompt(enum prvoid menu_add_expr (enum prop_type type,struct expr *expr,struct expr *dep);void menu_add_symbol (enum prop_type type,struct symbol *sym,struct expr *dep);void menu_add_option (int token,char *arg); +void menu_add_module_name (char *module_name);void menu_finalize (struct menu *parent);void menu_set_type (int type);
scripts/kconfig/mconf.c renamed from scripts/kconfig/mconf.c~kconfig-add-module_name-shortcut +2 -0
@@ -320,6 +320,8 @@ static void get_symbol_str(struct gstr *bool hit;struct property *prop; + for_all_properties(sym, prop, P_MODULE_NAME) +str_printf (r,_ ("Module name: %s\n\n" ), prop->module_name);if (sym && sym->name)str_printf (r,"Symbol: %s [=%s]\n" , sym->name,sym_get_string_value (sym));
scripts/kconfig/menu.c renamed from scripts/kconfig/menu.c~kconfig-add-module_name-shortcut +8 -0
@@ -178,6 +178,14 @@ void menu_add_option(int token, char *ar } } +void menu_add_module_name (char *module_name) +{ +struct property *prop; + + prop =prop_alloc (P_MODULE_NAME , current_entry->sym); + prop->module_name =strdup (module_name); +} +static int menu_range_valid_sym (struct symbol *sym,struct symbol *sym2) { return sym2->type == S_INT || sym2->type == S_HEX ||
scripts/kconfig/symbol.c renamed from scripts/kconfig/symbol.c~kconfig-add-module_name-shortcut +2 -0
@@ -937,6 +937,8 @@ const char *prop_get_type_name(enum propreturn "select" ;case P_RANGE :return "range" ; +case P_MODULE_NAME : +return "module_name" ;case P_UNKNOWN :break ; }
scripts/kconfig/zconf.gperf renamed from scripts/kconfig/zconf.gperf~kconfig-add-module_name-shortcut +1 -0
@@ -41,4 +41,5 @@ on, T_ON, TF_PARAM modules, T_OPT_MODULES, TF_OPTION defconfig_list, T_OPT_DEFCONFIG_LIST,TF_OPTION env, T_OPT_ENV, TF_OPTION +module_name, T_MODULE_NAME, TF_COMMAND %%
scripts/kconfig/zconf.hash.c_shipped renamed from scripts/kconfig/zconf.hash.c_shipped~kconfig-add-module_name-shortcut +95 -89
259 lines not on this page · raw message
scripts/kconfig/zconf.tab.c_shipped renamed from scripts/kconfig/zconf.tab.c_shipped~kconfig-add-module_name-shortcut +279 -260
873 lines not on this page · raw message
scripts/kconfig/zconf.y renamed from scripts/kconfig/zconf.y~kconfig-add-module_name-shortcut +12 -0
@@ -72,6 +72,7 @@ static struct menu *current_menu, *curre %token <id>T_RANGE %token <id>T_OPTION %token <id>T_ON +%token <id>T_MODULE_NAME %token <string> T_WORD %token <string> T_WORD_QUOTE %token T_UNEQUAL
@@ -90,6 +91,7 @@ static struct menu *current_menu, *curre %type <expr> if_expr %type <id> end %type <id> option_name +%type <string> module_name %type <menu> if_entry menu_entry choice_entry %type <string> symbol_option_arg word_opt
@@ -217,6 +219,12 @@ config_option: T_RANGE symbol symbol if_ printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno()); }; +config_option: T_MODULE_NAME module_name T_EOL +{ + menu_add_module_name($2); + printd(DEBUG_PARSE, "%s:%d:module_name\n", zconf_curname(), zconf_lineno()); +}; + symbol_option: T_OPTION symbol_option_list T_EOL ;
@@ -461,6 +469,10 @@ symbol: T_WORD { $$ = sym_lookup($1, 0 word_opt: /* empty */ { $$ = NULL; } | T_WORD +; + +module_name: T_WORD { $$ = $1 } +; %%
_
Quoted 15 lines · On Wed, Oct 29, 2008 at 02:20:14PM -0700, [email protected] wrote:
From: Alexey Dobriyan <[email protected]>
As correctly noticed in bug 11446
(http://bugzilla.kernel.org/show_bug.cgi?id=11446) "To compile this driver as a module, blah-blah" boilerplate is being copy-pasted to death with slight variations.Add
Kconfigtoken "module_name" to supply module's name. Example:config FOO tristate "foo" module_name foo ---help--- foo
Quoted 8 lines
Print module's name as following on menuconfigs help screen (press 'h'):
Module name: foo
8139too driver converted to show real-life example.
P.S.: menuconfig only, no checking wrt modular/standalone code et al.
...
We have 4 interfaces, and for not losing information all of them have to support it.
Quoted 6 lines
drivers/net/Kconfig renamed from drivers/net/Kconfig~kconfig-add-module_name-shortcut +0
-0@@ -1549,14 +1549,12 @@ config 8139TOO depends on NET_PCI && PCI select CRC32 select MII
drivers/net/Kconfig config 8139TOO · line 1559
Quoted 10 lines
drivers/net/Kconfig renamed from drivers/net/Kconfig~kconfig-add-module_name-shortcut +1
-3+ module_name 8139too ---help--- This is a driver for the Fast Ethernet PCI network cards based on the RTL 8129/8130/8139 chips. If you have one of those, say Y and read the Ethernet-HOWTO <http://www.tldp.org/docs.html#howto>. - To compile this driver as a module, choose M here: the module - will be called 8139too. This is recommended. -
Are you planning any further usage of the module_name?
Currently your patch seems to be in menuconfig equivalent to
- To compile this driver as a module, choose M here: the module
- will be called 8139too. This is recommended.
+ Module name: 8139too
I don't have any strong opinion whether that's better or worse, but if that's the only change we don't need a new kconfig syntax for it.
cu
Adrian
Signature · 4 lines
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon SeedQuoted 47 lines · Adrian Bunk
Quoted 10 lines · On Wed, Oct 29, 2008 at 02:20:14PM -0700, [email protected] wrote:
From: Alexey Dobriyan <[email protected]>
Add
Kconfigtoken "module_name" to supply module's name. Example:config FOO tristate "foo" module_name foo ---help--- fooQuoted 8 lines
Print module's name as following on menuconfigs help screen (press 'h'):
Module name: foo
8139too driver converted to show real-life example.
P.S.: menuconfig only, no checking wrt modular/standalone code et al.
...We have 4 interfaces, and for not losing information all of them have to support it.
Quoted 6 lines
drivers/net/Kconfig renamed from drivers/net/Kconfig~kconfig-add-module_name-shortcut +0
-0@@ -1549,14 +1549,12 @@ config 8139TOO depends on NET_PCI && PCI select CRC32 select MIIdrivers/net/Kconfig config 8139TOO · line 1559
Quoted 10 lines
drivers/net/Kconfig renamed from drivers/net/Kconfig~kconfig-add-module_name-shortcut +1
-3+ module_name 8139too ---help--- This is a driver for the Fast Ethernet PCI network cards based on the RTL 8129/8130/8139 chips. If you have one of those, say Y and read the Ethernet-HOWTO <http://www.tldp.org/docs.html#howto>. - To compile this driver as a module, choose M here: the module - will be called 8139too. This is recommended. -Are you planning any further usage of the
module_name?Currently your patch seems to be in menuconfig equivalent to
drivers/net/Kconfig renamed from drivers/net/Kconfig~kconfig-add-module_name-shortcut +1
-2- To compile this driver as a module, choose M here: the module - will be called 8139too. This is recommended. + Module name: 8139too
Quoted 1 line
I don't have any strong opinion whether that's better or worse, but if that's the only change we don't need a new kconfig syntax for it.
This feature is very useful for auto configuration: from a lsmod you will find easily the relevant configuration.
Actually I'm doing it with some complexer scripts, but some Makefile are "creative".
I had some plan to include more building information to Kconfig to automatically generating some part of Makefile's.
ciao
cate
Quoted 42 lines · Giacomo A. Catenazzi
Quoted 41 lines · Adrian Bunk
Quoted 10 lines · On Wed, Oct 29, 2008 at 02:20:14PM -0700, [email protected] wrote:
From: Alexey Dobriyan <[email protected]>
Add
Kconfigtoken "module_name" to supply module's name. Example:config FOO tristate "foo" module_name foo ---help--- fooQuoted 8 lines
Print module's name as following on menuconfigs help screen (press 'h'):
Module name: foo
8139too driver converted to show real-life example.
P.S.: menuconfig only, no checking wrt modular/standalone code et al.
...We have 4 interfaces, and for not losing information all of them have to support it.
Quoted 5 lines
drivers/net/Kconfig renamed from drivers/net/Kconfig~kconfig-add-module_name-shortcut +0
-0@@ -1549,14 +1549,12 @@ config 8139TOO depends on NET_PCI && PCI select CRC32drivers/net/Kconfig config 8139TOO · line 1558
Quoted 10 lines
drivers/net/Kconfig renamed from drivers/net/Kconfig~kconfig-add-module_name-shortcut +1
-2select MII + module_name 8139too ---help--- This is a driver for the Fast Ethernet PCI network cards based on the RTL 8129/8130/8139 chips. If you have one of those, say Y and read the Ethernet-HOWTO <http://www.tldp.org/docs.html#howto>. - To compile this driver as a module, choose M here: the module - will be called 8139too. This is recommended. -Are you planning any further usage of the
module_name?
Quoted 8 lines
Quoted 8 lines
Currently your patch seems to be in menuconfig equivalent to
drivers/net/Kconfig renamed from drivers/net/Kconfig~kconfig-add-module_name-shortcut +1
-2- To compile this driver as a module, choose M here: the module - will be called 8139too. This is recommended. + Module name: 8139tooI don't have any strong opinion whether that's better or worse, but if that's the only change we don't need a new kconfig syntax for it.
Well, it can be extended into "goto Kconfig symbol which controls this module [enter module name]". Or something else.
We can check if bool symbol has module_name for some reason and investigate.
Kconfig and Makefiles are deeply interconnected and module_name exploits that.
Quoted 17 lines · Alexey Dobriyan
Quoted 16 lines · Giacomo A. Catenazzi
Quoted 15 lines · Adrian Bunk
Quoted 14 lines · On Wed, Oct 29, 2008 at 02:20:14PM -0700, [email protected] wrote:
From: Alexey Dobriyan <[email protected]>
Add
Kconfigtoken "module_name" to supply module's name. Example:config FOO tristate "foo" module_name foo ---help--- fooPrint module's name as following on menuconfigs help screen (press 'h'):
Module name: foo
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
8139too driver converted to show real-life example.
P.S.: menuconfig only, no checking wrt modular/standalone code et al.
...We have 4 interfaces, and for not losing information all of them have to support it.
This is IMHO a blocker before you can change the 8139TOO option.
Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
Quoted 5 lines
drivers/net/Kconfig renamed from drivers/net/Kconfig~kconfig-add-module_name-shortcut +0
-0@@ -1549,14 +1549,12 @@ config 8139TOO depends on NET_PCI && PCI select CRC32drivers/net/Kconfig config 8139TOO · line 1558
Quoted 10 lines
drivers/net/Kconfig renamed from drivers/net/Kconfig~kconfig-add-module_name-shortcut +1
-2select MII + module_name 8139too ---help--- This is a driver for the Fast Ethernet PCI network cards based on the RTL 8129/8130/8139 chips. If you have one of those, say Y and read the Ethernet-HOWTO <http://www.tldp.org/docs.html#howto>. - To compile this driver as a module, choose M here: the module - will be called 8139too. This is recommended. -Are you planning any further usage of the
module_name?Currently your patch seems to be in menuconfig equivalent to
drivers/net/Kconfig renamed from drivers/net/Kconfig~kconfig-add-module_name-shortcut +1
-2- To compile this driver as a module, choose M here: the module - will be called 8139too. This is recommended. + Module name: 8139too
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
I don't have any strong opinion whether that's better or worse, but if that's the only change we don't need a new kconfig syntax for it.
Well, it can be extended into "goto
Kconfigsymbol which controls this module [enter module name]". Or something else.
...
Your patch lacks an addition to Documentation/kbuild/kconfig-language.txt describing the semantics.
Can an option have two module_name entries if it results in two options being built? If yes, what is the syntax?
Is it allowed to have several options listing the same module if each of them builds it?
The semantics and syntax should be well-defined before we start converting one thousand kconfig options.
cu
Adrian
Signature · 4 lines
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed