diff options
author | Arve Hjønnevåg <arve@android.com> | 2013-06-06 23:37:00 -0400 |
---|---|---|
committer | Yann E. MORIN <yann.morin.1998@free.fr> | 2013-06-16 05:00:30 -0400 |
commit | fbe98bb9ed3dae23e320c6b113e35f129538d14a (patch) | |
tree | ffb4c7484e0fa5d4ee2a0ae546f0fd853d373db7 /scripts | |
parent | f722406faae2d073cc1d01063d1123c35425939e (diff) |
kconfig: Fix defconfig when one choice menu selects options that another choice menu depends on
The defconfig and Kconfig combination below, which is based on 3.10-rc4
Kconfigs, resulted in several options getting set to "m" instead of "y".
defconfig.choice:
---8<---
CONFIG_MODULES=y
CONFIG_USB_ZERO=y
---8<---
Kconfig.choice:
---8<---
menuconfig MODULES
bool "Enable loadable module support"
config CONFIGFS_FS
tristate "Userspace-driven configuration filesystem"
config OCFS2_FS
tristate "OCFS2 file system support"
depends on CONFIGFS_FS
select CRC32
config USB_LIBCOMPOSITE
tristate
select CONFIGFS_FS
choice
tristate "USB Gadget Drivers"
default USB_ETH
config USB_ZERO
tristate "Gadget Zero (DEVELOPMENT)"
select USB_LIBCOMPOSITE
config USB_ETH
tristate "Ethernet Gadget (with CDC Ethernet support)"
select USB_LIBCOMPOSITE
endchoice
config CRC32
tristate "CRC32/CRC32c functions"
default y
choice
prompt "CRC32 implementation"
depends on CRC32
default CRC32_SLICEBY8
config CRC32_SLICEBY8
bool "Slice by 8 bytes"
endchoice
---8<---
$ scripts/kconfig/conf --defconfig=defconfig.choice Kconfig.choice
would result in:
.config:
---8<---
CONFIG_MODULES=y
CONFIG_CONFIGFS_FS=m
CONFIG_USB_LIBCOMPOSITE=m
CONFIG_USB_ZERO=m
CONFIG_CRC32=y
CONFIG_CRC32_SLICEBY8=y
---8<---
when the expected result would be:
.config:
---8<---
CONFIG_MODULES=y
CONFIG_CONFIGFS_FS=y
CONFIG_USB_LIBCOMPOSITE=y
CONFIG_USB_ZERO=y
CONFIG_CRC32=y
CONFIG_CRC32_SLICEBY8=y
---8<---
Signed-off-by: Arve Hjønnevåg <arve@android.com>
[yann.morin.1998@free.fr: add the resulting .config to commit log,
remove unneeded USB_GADGET from the defconfig]
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/kconfig/confdata.c | 14 | ||||
-rw-r--r-- | scripts/kconfig/expr.h | 3 | ||||
-rw-r--r-- | scripts/kconfig/lkc.h | 1 | ||||
-rw-r--r-- | scripts/kconfig/symbol.c | 11 |
4 files changed, 25 insertions, 4 deletions
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 43eda40c3838..35e0f164ef81 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c | |||
@@ -1083,7 +1083,7 @@ static void randomize_choice_values(struct symbol *csym) | |||
1083 | csym->flags &= ~(SYMBOL_VALID); | 1083 | csym->flags &= ~(SYMBOL_VALID); |
1084 | } | 1084 | } |
1085 | 1085 | ||
1086 | static void set_all_choice_values(struct symbol *csym) | 1086 | void set_all_choice_values(struct symbol *csym) |
1087 | { | 1087 | { |
1088 | struct property *prop; | 1088 | struct property *prop; |
1089 | struct symbol *sym; | 1089 | struct symbol *sym; |
@@ -1100,7 +1100,7 @@ static void set_all_choice_values(struct symbol *csym) | |||
1100 | } | 1100 | } |
1101 | csym->flags |= SYMBOL_DEF_USER; | 1101 | csym->flags |= SYMBOL_DEF_USER; |
1102 | /* clear VALID to get value calculated */ | 1102 | /* clear VALID to get value calculated */ |
1103 | csym->flags &= ~(SYMBOL_VALID); | 1103 | csym->flags &= ~(SYMBOL_VALID | SYMBOL_NEED_SET_CHOICE_VALUES); |
1104 | } | 1104 | } |
1105 | 1105 | ||
1106 | void conf_set_all_new_symbols(enum conf_def_mode mode) | 1106 | void conf_set_all_new_symbols(enum conf_def_mode mode) |
@@ -1202,6 +1202,14 @@ void conf_set_all_new_symbols(enum conf_def_mode mode) | |||
1202 | * selected in a choice block and we set it to yes, | 1202 | * selected in a choice block and we set it to yes, |
1203 | * and the rest to no. | 1203 | * and the rest to no. |
1204 | */ | 1204 | */ |
1205 | if (mode != def_random) { | ||
1206 | for_all_symbols(i, csym) { | ||
1207 | if ((sym_is_choice(csym) && !sym_has_value(csym)) || | ||
1208 | sym_is_choice_value(csym)) | ||
1209 | csym->flags |= SYMBOL_NEED_SET_CHOICE_VALUES; | ||
1210 | } | ||
1211 | } | ||
1212 | |||
1205 | for_all_symbols(i, csym) { | 1213 | for_all_symbols(i, csym) { |
1206 | if (sym_has_value(csym) || !sym_is_choice(csym)) | 1214 | if (sym_has_value(csym) || !sym_is_choice(csym)) |
1207 | continue; | 1215 | continue; |
@@ -1209,7 +1217,5 @@ void conf_set_all_new_symbols(enum conf_def_mode mode) | |||
1209 | sym_calc_value(csym); | 1217 | sym_calc_value(csym); |
1210 | if (mode == def_random) | 1218 | if (mode == def_random) |
1211 | randomize_choice_values(csym); | 1219 | randomize_choice_values(csym); |
1212 | else | ||
1213 | set_all_choice_values(csym); | ||
1214 | } | 1220 | } |
1215 | } | 1221 | } |
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h index cdd48600e02a..df198a5f4822 100644 --- a/scripts/kconfig/expr.h +++ b/scripts/kconfig/expr.h | |||
@@ -106,6 +106,9 @@ struct symbol { | |||
106 | #define SYMBOL_DEF3 0x40000 /* symbol.def[S_DEF_3] is valid */ | 106 | #define SYMBOL_DEF3 0x40000 /* symbol.def[S_DEF_3] is valid */ |
107 | #define SYMBOL_DEF4 0x80000 /* symbol.def[S_DEF_4] is valid */ | 107 | #define SYMBOL_DEF4 0x80000 /* symbol.def[S_DEF_4] is valid */ |
108 | 108 | ||
109 | /* choice values need to be set before calculating this symbol value */ | ||
110 | #define SYMBOL_NEED_SET_CHOICE_VALUES 0x100000 | ||
111 | |||
109 | #define SYMBOL_MAXLENGTH 256 | 112 | #define SYMBOL_MAXLENGTH 256 |
110 | #define SYMBOL_HASHSIZE 9973 | 113 | #define SYMBOL_HASHSIZE 9973 |
111 | 114 | ||
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index f8aee5fc6d5e..0c8d4191ca87 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h | |||
@@ -87,6 +87,7 @@ char *conf_get_default_confname(void); | |||
87 | void sym_set_change_count(int count); | 87 | void sym_set_change_count(int count); |
88 | void sym_add_change_count(int count); | 88 | void sym_add_change_count(int count); |
89 | void conf_set_all_new_symbols(enum conf_def_mode mode); | 89 | void conf_set_all_new_symbols(enum conf_def_mode mode); |
90 | void set_all_choice_values(struct symbol *csym); | ||
90 | 91 | ||
91 | struct conf_printer { | 92 | struct conf_printer { |
92 | void (*print_symbol)(FILE *, struct symbol *, const char *, void *); | 93 | void (*print_symbol)(FILE *, struct symbol *, const char *, void *); |
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index ecc5aa5f865d..ab8f4c835933 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c | |||
@@ -300,6 +300,14 @@ void sym_calc_value(struct symbol *sym) | |||
300 | 300 | ||
301 | if (sym->flags & SYMBOL_VALID) | 301 | if (sym->flags & SYMBOL_VALID) |
302 | return; | 302 | return; |
303 | |||
304 | if (sym_is_choice_value(sym) && | ||
305 | sym->flags & SYMBOL_NEED_SET_CHOICE_VALUES) { | ||
306 | sym->flags &= ~SYMBOL_NEED_SET_CHOICE_VALUES; | ||
307 | prop = sym_get_choice_prop(sym); | ||
308 | sym_calc_value(prop_get_symbol(prop)); | ||
309 | } | ||
310 | |||
303 | sym->flags |= SYMBOL_VALID; | 311 | sym->flags |= SYMBOL_VALID; |
304 | 312 | ||
305 | oldval = sym->curr; | 313 | oldval = sym->curr; |
@@ -425,6 +433,9 @@ void sym_calc_value(struct symbol *sym) | |||
425 | 433 | ||
426 | if (sym->flags & SYMBOL_AUTO) | 434 | if (sym->flags & SYMBOL_AUTO) |
427 | sym->flags &= ~SYMBOL_WRITE; | 435 | sym->flags &= ~SYMBOL_WRITE; |
436 | |||
437 | if (sym->flags & SYMBOL_NEED_SET_CHOICE_VALUES) | ||
438 | set_all_choice_values(sym); | ||
428 | } | 439 | } |
429 | 440 | ||
430 | void sym_clear_all_valid(void) | 441 | void sym_clear_all_valid(void) |