From 5d09598d488f081e3be23f885ed65cbbe2d073b5 Mon Sep 17 00:00:00 2001 From: Arnaud Lacombe Date: Mon, 23 Jan 2012 17:29:05 -0500 Subject: kconfig: fix new choices being skipped upon config update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Running `oldconfig' after any of the following configuration change: either trivial addition, such as: config A bool "A" choice prompt "Choice ?" depends on A config CHOICE_B bool "Choice B" config CHOICE_C bool "Choice C" endchoice or more tricky change: OLD KCONFIG | NEW KCONFIG | | config A | bool "A" | choice | choice prompt "Choice ?" | prompt "Choice ?" | config CHOICE_C | config CHOICE_C bool "Choice C" | bool "Choice C" | config CHOICE_D | config CHOICE_D bool "Choice D" | bool "Choice D" endchoice | | config CHOICE_E | bool "Choice E" | depends on A | endchoice will not cause the choice to be considered as NEW, and thus not be asked. The cause of this behavior is that choice's novelty are computed statically right after the saved configuration has been read. At this point, the new dependency's value is still unknown and asserted to be `no'. Moreover, no update to this decision is made afterward. Correct this by dynamically evaluating a choice's novelty, and removing the static evaluation. Reported-and-tested-by: Uwe Kleine-König Signed-off-by: Arnaud Lacombe Signed-off-by: Michal Marek --- scripts/kconfig/confdata.c | 26 ++++++-------------------- scripts/kconfig/symbol.c | 9 ++++++++- 2 files changed, 14 insertions(+), 21 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 7c7a5a6cc3f5..0586085136d1 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -344,10 +344,8 @@ setsym: int conf_read(const char *name) { - struct symbol *sym, *choice_sym; - struct property *prop; - struct expr *e; - int i, flags; + struct symbol *sym; + int i; sym_set_change_count(0); @@ -357,7 +355,7 @@ int conf_read(const char *name) for_all_symbols(i, sym) { sym_calc_value(sym); if (sym_is_choice(sym) || (sym->flags & SYMBOL_AUTO)) - goto sym_ok; + continue; if (sym_has_value(sym) && (sym->flags & SYMBOL_WRITE)) { /* check that calculated value agrees with saved value */ switch (sym->type) { @@ -366,30 +364,18 @@ int conf_read(const char *name) if (sym->def[S_DEF_USER].tri != sym_get_tristate_value(sym)) break; if (!sym_is_choice(sym)) - goto sym_ok; + continue; /* fall through */ default: if (!strcmp(sym->curr.val, sym->def[S_DEF_USER].val)) - goto sym_ok; + continue; break; } } else if (!sym_has_value(sym) && !(sym->flags & SYMBOL_WRITE)) /* no previous value and not saved */ - goto sym_ok; + continue; conf_unsaved++; /* maybe print value in verbose mode... */ - sym_ok: - if (!sym_is_choice(sym)) - continue; - /* The choice symbol only has a set value (and thus is not new) - * if all its visible childs have values. - */ - prop = sym_get_choice_prop(sym); - flags = sym->flags; - expr_list_for_each_sym(prop->expr, e, choice_sym) - if (choice_sym->visible != no) - flags &= choice_sym->flags; - sym->flags &= flags | ~SYMBOL_DEF_USER; } for_all_symbols(i, sym) { diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index 071f00c3046e..22a3c400fc41 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -262,11 +262,18 @@ static struct symbol *sym_calc_choice(struct symbol *sym) struct symbol *def_sym; struct property *prop; struct expr *e; + int flags; /* first calculate all choice values' visibilities */ + flags = sym->flags; prop = sym_get_choice_prop(sym); - expr_list_for_each_sym(prop->expr, e, def_sym) + expr_list_for_each_sym(prop->expr, e, def_sym) { sym_calc_visibility(def_sym); + if (def_sym->visible != no) + flags &= def_sym->flags; + } + + sym->flags &= flags | ~SYMBOL_DEF_USER; /* is the user choice visible? */ def_sym = sym->def[S_DEF_USER].val; -- cgit v1.2.3-59-g8ed1b From 09280615a0d924b3ab79acbff950f92c3420fd76 Mon Sep 17 00:00:00 2001 From: Josh Boyer Date: Wed, 1 Feb 2012 12:01:58 -0500 Subject: merge_config.sh: Use the first file as the initial config Take the first config fragment and use it verbatim as the initial config set. This avoids running the verification loop for the first file, as nothing has actually been merged at this point. This significantly increases performance for large config fragments. Signed-off-by: Josh Boyer Acked-by: John Stultz Acked-by: Darren Hart Signed-off-by: Michal Marek --- scripts/kconfig/merge_config.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh index ceadf0e150cf..23d738a1acda 100644 --- a/scripts/kconfig/merge_config.sh +++ b/scripts/kconfig/merge_config.sh @@ -58,12 +58,16 @@ while true; do esac done - +INITFILE=$1 +shift; MERGE_LIST=$* SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[= ].*/\2/p" TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX) +echo "Using $INITFILE as base" +cat $INITFILE > $TMP_FILE + # Merge files, printing warnings on overrided values for MERGE_FILE in $MERGE_LIST ; do echo "Merging $MERGE_FILE" -- cgit v1.2.3-59-g8ed1b From 55cae3043a48e01f8fc31e8aecc3062c4767a27d Mon Sep 17 00:00:00 2001 From: John Stultz Date: Thu, 22 Mar 2012 15:05:48 -0700 Subject: merge_config.sh: Set execute bit Somehow the merge_config.sh script didn't get its execute bit set when it was merged. Fix this. Signed-off-by: John Stultz Acked-by: Darren Hart Acked-by: Bruce Ashfield Signed-off-by: Michal Marek --- scripts/kconfig/merge_config.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/kconfig/merge_config.sh (limited to 'scripts') diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh old mode 100644 new mode 100755 -- cgit v1.2.3-59-g8ed1b From 9875c42d6979a7db0b8d217e2a88095b753f482c Mon Sep 17 00:00:00 2001 From: John Stultz Date: Fri, 23 Mar 2012 12:52:08 -0700 Subject: merge_config.sh: Add option to display redundant configs Provide a -r option to display when fragments contain redundant options. This is really useful when breaking apart a config into fragments, as well as cleaning up older fragments. Signed-off-by: John Stultz Acked-by: Darren Hart Acked-by: Bruce Ashfield Signed-off-by: Michal Marek --- scripts/kconfig/merge_config.sh | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'scripts') diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh index 23d738a1acda..974d5cb7e30a 100755 --- a/scripts/kconfig/merge_config.sh +++ b/scripts/kconfig/merge_config.sh @@ -31,10 +31,12 @@ usage() { echo " -h display this help text" echo " -m only merge the fragments, do not execute the make command" echo " -n use allnoconfig instead of alldefconfig" + echo " -r list redundant entries when merging fragments" } MAKE=true ALLTARGET=alldefconfig +WARNREDUN=false while true; do case $1 in @@ -52,6 +54,11 @@ while true; do usage exit ;; + "-r") + WARNREDUN=true + shift + continue + ;; *) break ;; @@ -83,6 +90,8 @@ for MERGE_FILE in $MERGE_LIST ; do echo Previous value: $PREV_VAL echo New value: $NEW_VAL echo + elif [ "$WARNREDUN" = "true" ]; then + echo Value of $CFG is redundant by fragment $MERGE_FILE: fi sed -i "/$CFG[ =]/d" $TMP_FILE fi -- cgit v1.2.3-59-g8ed1b