kbuild: fixing the select problem
diff mbox

Message ID 1273178915.2881.20.camel@mulgrave.site
State New, archived
Headers show

Commit Message

James Bottomley May 6, 2010, 8:48 p.m. UTC
None

Patch
diff mbox

diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 6c8fbbb..722bc4e 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -115,14 +115,31 @@  struct property *sym_get_env_prop(struct symbol *sym)
 
 struct property *sym_get_default_prop(struct symbol *sym)
 {
-	struct property *prop;
+	struct property *prop, *ret = NULL;
+	tristate old_val = no, val = no;
 
 	for_all_defaults(sym, prop) {
 		prop->visible.tri = expr_calc_value(prop->visible.expr);
-		if (prop->visible.tri != no)
-			return prop;
+		if (prop->visible.tri != no) {
+			tristate v = expr_calc_value(prop->expr);
+			if (!ret)
+				old_val = v;
+			if (v >= val) {
+				val = v;
+				ret = prop;
+			}
+		}
 	}
-	return NULL;
+	/*
+	 * Previously, we took the first valid default we found (this
+	 * is now old_val).  In the new scheme, the value is the or of
+	 * all the defaults.
+	 */
+	if (old_val != val)
+		menu_warn(ret->menu, "ERROR: new parser has inconsistent "
+			  "values for %s (%d != %d)\n", sym->name,
+			  old_val, val);
+	return ret;
 }
 
 static struct property *sym_get_range_prop(struct symbol *sym)