Commit bae79439 authored by Roman Zippel's avatar Roman Zippel Committed by Linus Torvalds

[PATCH] Optional choice values get reset

Patch by Herbert Xu <herbert@gondor.apana.org.au>:

As of 2.5.74, make oldconfig always disables existing optional choices
even if they were selected previously.  For example, if all the EICON
ISDN drivers were selected as modules, then make oldconfig will turn
them off.

Part of the problem is that the choice value itself is computed before
the SYMBOL_NEW flag is turned off.  This patch addresses that particular
problem.
parent 669ee167
...@@ -115,6 +115,7 @@ int conf_read(const char *name) ...@@ -115,6 +115,7 @@ int conf_read(const char *name)
while (fgets(line, sizeof(line), in)) { while (fgets(line, sizeof(line), in)) {
lineno++; lineno++;
sym = NULL;
switch (line[0]) { switch (line[0]) {
case '#': case '#':
if (memcmp(line + 2, "CONFIG_", 7)) if (memcmp(line + 2, "CONFIG_", 7))
...@@ -133,7 +134,7 @@ int conf_read(const char *name) ...@@ -133,7 +134,7 @@ int conf_read(const char *name)
switch (sym->type) { switch (sym->type) {
case S_BOOLEAN: case S_BOOLEAN:
case S_TRISTATE: case S_TRISTATE:
sym->user = symbol_no.curr; sym->user.tri = no;
sym->flags &= ~SYMBOL_NEW; sym->flags &= ~SYMBOL_NEW;
break; break;
default: default:
...@@ -201,9 +202,17 @@ int conf_read(const char *name) ...@@ -201,9 +202,17 @@ int conf_read(const char *name)
default: default:
; ;
} }
if (sym_is_choice_value(sym)) { break;
case '\n':
break;
default:
continue;
}
if (sym && sym_is_choice_value(sym)) {
struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym)); struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym));
switch (sym->user.tri) { switch (sym->user.tri) {
case no:
break;
case mod: case mod:
if (cs->user.tri == yes) if (cs->user.tri == yes)
/* warn? */; /* warn? */;
...@@ -213,23 +222,16 @@ int conf_read(const char *name) ...@@ -213,23 +222,16 @@ int conf_read(const char *name)
/* warn? */; /* warn? */;
cs->user.val = sym; cs->user.val = sym;
break; break;
case no:
break;
} }
cs->user.tri = sym->user.tri; cs->user.tri = E_OR(cs->user.tri, sym->user.tri);
} cs->flags &= ~SYMBOL_NEW;
break;
case '\n':
break;
default:
continue;
} }
} }
fclose(in); fclose(in);
for_all_symbols(i, sym) { for_all_symbols(i, sym) {
sym_calc_value(sym); sym_calc_value(sym);
if (sym_has_value(sym)) { if (sym_has_value(sym) && !sym_is_choice_value(sym)) {
if (sym->visible == no) if (sym->visible == no)
sym->flags |= SYMBOL_NEW; sym->flags |= SYMBOL_NEW;
switch (sym->type) { switch (sym->type) {
...@@ -245,7 +247,6 @@ int conf_read(const char *name) ...@@ -245,7 +247,6 @@ int conf_read(const char *name)
if (!sym_is_choice(sym)) if (!sym_is_choice(sym))
continue; continue;
prop = sym_get_choice_prop(sym); prop = sym_get_choice_prop(sym);
sym->flags &= ~SYMBOL_NEW;
for (e = prop->expr; e; e = e->left.expr) for (e = prop->expr; e; e = e->left.expr)
if (e->right.sym->visible != no) if (e->right.sym->visible != no)
sym->flags |= e->right.sym->flags & SYMBOL_NEW; sym->flags |= e->right.sym->flags & SYMBOL_NEW;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment