diff options
author | Sam Ravnborg <sam@ravnborg.org> | 2010-08-14 17:22:16 -0400 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2010-08-14 18:32:12 -0400 |
commit | 84062dd3a6a045395a43de1d9adc9b8eb2d1426e (patch) | |
tree | 708038ff4d462f87fe6d3a26a99266172d9afd90 | |
parent | 4418a2b904805814bbd14b555d6add6a175f49f3 (diff) |
kconfig: fix savedefconfig with choice marked optional
savedefconfig failed to save the correct minimal config
when it encountered a choice marked optional.
Consider following minimal configuration:
$cat Kconfig
choice
prompt "choice"
optional
config A
bool "a"
config B
bool "b"
endchoice
$cat .config | grep -v ^#
CONFIG_A=y
$conf --savedefconfig=defconfig Kconfig
would before this fix result in an empty file, because
kconfig would assume that CONFIG_A=y is a default value.
But because the choice is optional the default is that
both A and B are =n.
Fix so we handle optional choices correct.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
-rw-r--r-- | scripts/kconfig/confdata.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index c39327e60ea4..515253fe46cf 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c | |||
@@ -497,7 +497,9 @@ int conf_write_defconfig(const char *filename) | |||
497 | /* | 497 | /* |
498 | * If symbol is a choice value and equals to the | 498 | * If symbol is a choice value and equals to the |
499 | * default for a choice - skip. | 499 | * default for a choice - skip. |
500 | * But only if value is bool and equal to "y" . | 500 | * But only if value is bool and equal to "y" and |
501 | * choice is not "optional". | ||
502 | * (If choice is "optional" then all values can be "n") | ||
501 | */ | 503 | */ |
502 | if (sym_is_choice_value(sym)) { | 504 | if (sym_is_choice_value(sym)) { |
503 | struct symbol *cs; | 505 | struct symbol *cs; |
@@ -505,7 +507,7 @@ int conf_write_defconfig(const char *filename) | |||
505 | 507 | ||
506 | cs = prop_get_symbol(sym_get_choice_prop(sym)); | 508 | cs = prop_get_symbol(sym_get_choice_prop(sym)); |
507 | ds = sym_choice_default(cs); | 509 | ds = sym_choice_default(cs); |
508 | if (sym == ds) { | 510 | if (!sym_is_optional(cs) && sym == ds) { |
509 | if ((sym->type == S_BOOLEAN) && | 511 | if ((sym->type == S_BOOLEAN) && |
510 | sym_get_tristate_value(sym) == yes) | 512 | sym_get_tristate_value(sym) == yes) |
511 | goto next_menu; | 513 | goto next_menu; |