linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kconfig: fix new choices being skipped upon config update
       [not found] <20120120164036.GO4066@pengutronix.de>
@ 2012-01-23 22:29 ` Arnaud Lacombe
  2012-01-26  9:26   ` Uwe Kleine-König
  0 siblings, 1 reply; 3+ messages in thread
From: Arnaud Lacombe @ 2012-01-23 22:29 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Arnaud Lacombe, LKML, Michal Marek, Uwe Kleine-Konig

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.

Cc: linux-kbuild@vger.kernel.org
Cc: LKML <linux-kernel@vger.kernel.org>,
Cc: Michal Marek <mmarek@suse.cz>
Cc: Uwe Kleine-Konig <u.kleine-koenig@pengutronix.de>
Reported-by: Uwe Kleine-Konig <u.kleine-koenig@pengutronix.de>
Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
---
 scripts/kconfig/confdata.c |   26 ++++++--------------------
 scripts/kconfig/symbol.c   |    9 ++++++++-
 2 files changed, 14 insertions(+), 21 deletions(-)

diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 5a58965..47aed3f 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -344,10 +344,8 @@ int conf_read_simple(const char *name, int def)
 
 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 071f00c..22a3c40 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;
-- 
1.7.9.rc1.23.g51649


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] kconfig: fix new choices being skipped upon config update
  2012-01-23 22:29 ` [PATCH] kconfig: fix new choices being skipped upon config update Arnaud Lacombe
@ 2012-01-26  9:26   ` Uwe Kleine-König
  2012-01-26 10:06     ` Michal Marek
  0 siblings, 1 reply; 3+ messages in thread
From: Uwe Kleine-König @ 2012-01-26  9:26 UTC (permalink / raw)
  To: Arnaud Lacombe; +Cc: linux-kbuild, LKML, Michal Marek

On Mon, Jan 23, 2012 at 05:29:05PM -0500, Arnaud Lacombe wrote:
> 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.
> 
> Cc: linux-kbuild@vger.kernel.org
> Cc: LKML <linux-kernel@vger.kernel.org>,
> Cc: Michal Marek <mmarek@suse.cz>
> Cc: Uwe Kleine-Konig <u.kleine-koenig@pengutronix.de>
> Reported-by: Uwe Kleine-Konig <u.kleine-koenig@pengutronix.de>
Tested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

(Please note the umlaut o in my name. If you have problems with that,
please at least write Kleine-Koenig.)

> Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>

Best regards and thanks
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] kconfig: fix new choices being skipped upon config update
  2012-01-26  9:26   ` Uwe Kleine-König
@ 2012-01-26 10:06     ` Michal Marek
  0 siblings, 0 replies; 3+ messages in thread
From: Michal Marek @ 2012-01-26 10:06 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Arnaud Lacombe, linux-kbuild, LKML

On 26.1.2012 10:26, Uwe Kleine-König wrote:
> On Mon, Jan 23, 2012 at 05:29:05PM -0500, Arnaud Lacombe wrote:
[...]
>> 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.
>>
>> Cc: linux-kbuild@vger.kernel.org
>> Cc: LKML <linux-kernel@vger.kernel.org>,
>> Cc: Michal Marek <mmarek@suse.cz>
>> Cc: Uwe Kleine-Konig <u.kleine-koenig@pengutronix.de>
>> Reported-by: Uwe Kleine-Konig <u.kleine-koenig@pengutronix.de>
> Tested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Thanks, applied to kbuild.git#kconfig.


> (Please note the umlaut o in my name. If you have problems with that,
> please at least write Kleine-Koenig.)

Fixed.

Michal

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-01-26 10:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20120120164036.GO4066@pengutronix.de>
2012-01-23 22:29 ` [PATCH] kconfig: fix new choices being skipped upon config update Arnaud Lacombe
2012-01-26  9:26   ` Uwe Kleine-König
2012-01-26 10:06     ` Michal Marek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).