aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scripts/kconfig/confdata.c34
-rw-r--r--scripts/kconfig/expr.h7
-rw-r--r--scripts/kconfig/symbol.c16
3 files changed, 31 insertions, 26 deletions
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 2da4a8d775a5..54ca1a786d25 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -134,11 +134,11 @@ load:
134 case S_INT: 134 case S_INT:
135 case S_HEX: 135 case S_HEX:
136 case S_STRING: 136 case S_STRING:
137 if (sym->user.val) 137 if (sym->def[S_DEF_USER].val)
138 free(sym->user.val); 138 free(sym->def[S_DEF_USER].val);
139 default: 139 default:
140 sym->user.val = NULL; 140 sym->def[S_DEF_USER].val = NULL;
141 sym->user.tri = no; 141 sym->def[S_DEF_USER].tri = no;
142 } 142 }
143 } 143 }
144 144
@@ -166,7 +166,7 @@ load:
166 switch (sym->type) { 166 switch (sym->type) {
167 case S_BOOLEAN: 167 case S_BOOLEAN:
168 case S_TRISTATE: 168 case S_TRISTATE:
169 sym->user.tri = no; 169 sym->def[S_DEF_USER].tri = no;
170 sym->flags &= ~SYMBOL_NEW; 170 sym->flags &= ~SYMBOL_NEW;
171 break; 171 break;
172 default: 172 default:
@@ -196,18 +196,18 @@ load:
196 switch (sym->type) { 196 switch (sym->type) {
197 case S_TRISTATE: 197 case S_TRISTATE:
198 if (p[0] == 'm') { 198 if (p[0] == 'm') {
199 sym->user.tri = mod; 199 sym->def[S_DEF_USER].tri = mod;
200 sym->flags &= ~SYMBOL_NEW; 200 sym->flags &= ~SYMBOL_NEW;
201 break; 201 break;
202 } 202 }
203 case S_BOOLEAN: 203 case S_BOOLEAN:
204 if (p[0] == 'y') { 204 if (p[0] == 'y') {
205 sym->user.tri = yes; 205 sym->def[S_DEF_USER].tri = yes;
206 sym->flags &= ~SYMBOL_NEW; 206 sym->flags &= ~SYMBOL_NEW;
207 break; 207 break;
208 } 208 }
209 if (p[0] == 'n') { 209 if (p[0] == 'n') {
210 sym->user.tri = no; 210 sym->def[S_DEF_USER].tri = no;
211 sym->flags &= ~SYMBOL_NEW; 211 sym->flags &= ~SYMBOL_NEW;
212 break; 212 break;
213 } 213 }
@@ -230,7 +230,7 @@ load:
230 case S_INT: 230 case S_INT:
231 case S_HEX: 231 case S_HEX:
232 if (sym_string_valid(sym, p)) { 232 if (sym_string_valid(sym, p)) {
233 sym->user.val = strdup(p); 233 sym->def[S_DEF_USER].val = strdup(p);
234 sym->flags &= ~SYMBOL_NEW; 234 sym->flags &= ~SYMBOL_NEW;
235 } else { 235 } else {
236 conf_warning("symbol value '%s' invalid for %s", p, sym->name); 236 conf_warning("symbol value '%s' invalid for %s", p, sym->name);
@@ -249,24 +249,24 @@ load:
249 } 249 }
250 if (sym && sym_is_choice_value(sym)) { 250 if (sym && sym_is_choice_value(sym)) {
251 struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym)); 251 struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym));
252 switch (sym->user.tri) { 252 switch (sym->def[S_DEF_USER].tri) {
253 case no: 253 case no:
254 break; 254 break;
255 case mod: 255 case mod:
256 if (cs->user.tri == yes) { 256 if (cs->def[S_DEF_USER].tri == yes) {
257 conf_warning("%s creates inconsistent choice state", sym->name); 257 conf_warning("%s creates inconsistent choice state", sym->name);
258 cs->flags |= SYMBOL_NEW; 258 cs->flags |= SYMBOL_NEW;
259 } 259 }
260 break; 260 break;
261 case yes: 261 case yes:
262 if (cs->user.tri != no) { 262 if (cs->def[S_DEF_USER].tri != no) {
263 conf_warning("%s creates inconsistent choice state", sym->name); 263 conf_warning("%s creates inconsistent choice state", sym->name);
264 cs->flags |= SYMBOL_NEW; 264 cs->flags |= SYMBOL_NEW;
265 } else 265 } else
266 cs->user.val = sym; 266 cs->def[S_DEF_USER].val = sym;
267 break; 267 break;
268 } 268 }
269 cs->user.tri = E_OR(cs->user.tri, sym->user.tri); 269 cs->def[S_DEF_USER].tri = E_OR(cs->def[S_DEF_USER].tri, sym->def[S_DEF_USER].tri);
270 } 270 }
271 } 271 }
272 fclose(in); 272 fclose(in);
@@ -297,12 +297,12 @@ int conf_read(const char *name)
297 switch (sym->type) { 297 switch (sym->type) {
298 case S_BOOLEAN: 298 case S_BOOLEAN:
299 case S_TRISTATE: 299 case S_TRISTATE:
300 if (sym->user.tri != sym_get_tristate_value(sym)) 300 if (sym->def[S_DEF_USER].tri != sym_get_tristate_value(sym))
301 break; 301 break;
302 if (!sym_is_choice(sym)) 302 if (!sym_is_choice(sym))
303 goto sym_ok; 303 goto sym_ok;
304 default: 304 default:
305 if (!strcmp(sym->curr.val, sym->user.val)) 305 if (!strcmp(sym->curr.val, sym->def[S_DEF_USER].val))
306 goto sym_ok; 306 goto sym_ok;
307 break; 307 break;
308 } 308 }
@@ -319,7 +319,7 @@ int conf_read(const char *name)
319 case S_STRING: 319 case S_STRING:
320 case S_INT: 320 case S_INT:
321 case S_HEX: 321 case S_HEX:
322 if (!sym_string_within_range(sym, sym->user.val)) { 322 if (!sym_string_within_range(sym, sym->def[S_DEF_USER].val)) {
323 sym->flags |= SYMBOL_NEW; 323 sym->flags |= SYMBOL_NEW;
324 sym->flags &= ~SYMBOL_VALID; 324 sym->flags &= ~SYMBOL_VALID;
325 } 325 }
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index 52ea4df8e349..043859d426d7 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -63,12 +63,17 @@ enum symbol_type {
63 S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING, S_OTHER 63 S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING, S_OTHER
64}; 64};
65 65
66enum {
67 S_DEF_USER, /* main user value */
68};
69
66struct symbol { 70struct symbol {
67 struct symbol *next; 71 struct symbol *next;
68 char *name; 72 char *name;
69 char *help; 73 char *help;
70 enum symbol_type type; 74 enum symbol_type type;
71 struct symbol_value curr, user; 75 struct symbol_value curr;
76 struct symbol_value def[4];
72 tristate visible; 77 tristate visible;
73 int flags; 78 int flags;
74 struct property *prop; 79 struct property *prop;
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index a0a467a4387b..4ea0050dcb16 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -227,7 +227,7 @@ static struct symbol *sym_calc_choice(struct symbol *sym)
227 struct expr *e; 227 struct expr *e;
228 228
229 /* is the user choice visible? */ 229 /* is the user choice visible? */
230 def_sym = sym->user.val; 230 def_sym = sym->def[S_DEF_USER].val;
231 if (def_sym) { 231 if (def_sym) {
232 sym_calc_visibility(def_sym); 232 sym_calc_visibility(def_sym);
233 if (def_sym->visible != no) 233 if (def_sym->visible != no)
@@ -306,7 +306,7 @@ void sym_calc_value(struct symbol *sym)
306 } else if (E_OR(sym->visible, sym->rev_dep.tri) != no) { 306 } else if (E_OR(sym->visible, sym->rev_dep.tri) != no) {
307 sym->flags |= SYMBOL_WRITE; 307 sym->flags |= SYMBOL_WRITE;
308 if (sym_has_value(sym)) 308 if (sym_has_value(sym))
309 newval.tri = sym->user.tri; 309 newval.tri = sym->def[S_DEF_USER].tri;
310 else if (!sym_is_choice(sym)) { 310 else if (!sym_is_choice(sym)) {
311 prop = sym_get_default_prop(sym); 311 prop = sym_get_default_prop(sym);
312 if (prop) 312 if (prop)
@@ -329,7 +329,7 @@ void sym_calc_value(struct symbol *sym)
329 if (sym->visible != no) { 329 if (sym->visible != no) {
330 sym->flags |= SYMBOL_WRITE; 330 sym->flags |= SYMBOL_WRITE;
331 if (sym_has_value(sym)) { 331 if (sym_has_value(sym)) {
332 newval.val = sym->user.val; 332 newval.val = sym->def[S_DEF_USER].val;
333 break; 333 break;
334 } 334 }
335 } 335 }
@@ -439,7 +439,7 @@ bool sym_set_tristate_value(struct symbol *sym, tristate val)
439 struct property *prop; 439 struct property *prop;
440 struct expr *e; 440 struct expr *e;
441 441
442 cs->user.val = sym; 442 cs->def[S_DEF_USER].val = sym;
443 cs->flags &= ~SYMBOL_NEW; 443 cs->flags &= ~SYMBOL_NEW;
444 prop = sym_get_choice_prop(cs); 444 prop = sym_get_choice_prop(cs);
445 for (e = prop->expr; e; e = e->left.expr) { 445 for (e = prop->expr; e; e = e->left.expr) {
@@ -448,7 +448,7 @@ bool sym_set_tristate_value(struct symbol *sym, tristate val)
448 } 448 }
449 } 449 }
450 450
451 sym->user.tri = val; 451 sym->def[S_DEF_USER].tri = val;
452 if (oldval != val) { 452 if (oldval != val) {
453 sym_clear_all_valid(); 453 sym_clear_all_valid();
454 if (sym == modules_sym) 454 if (sym == modules_sym)
@@ -596,15 +596,15 @@ bool sym_set_string_value(struct symbol *sym, const char *newval)
596 sym_set_changed(sym); 596 sym_set_changed(sym);
597 } 597 }
598 598
599 oldval = sym->user.val; 599 oldval = sym->def[S_DEF_USER].val;
600 size = strlen(newval) + 1; 600 size = strlen(newval) + 1;
601 if (sym->type == S_HEX && (newval[0] != '0' || (newval[1] != 'x' && newval[1] != 'X'))) { 601 if (sym->type == S_HEX && (newval[0] != '0' || (newval[1] != 'x' && newval[1] != 'X'))) {
602 size += 2; 602 size += 2;
603 sym->user.val = val = malloc(size); 603 sym->def[S_DEF_USER].val = val = malloc(size);
604 *val++ = '0'; 604 *val++ = '0';
605 *val++ = 'x'; 605 *val++ = 'x';
606 } else if (!oldval || strcmp(oldval, newval)) 606 } else if (!oldval || strcmp(oldval, newval))
607 sym->user.val = val = malloc(size); 607 sym->def[S_DEF_USER].val = val = malloc(size);
608 else 608 else
609 return true; 609 return true;
610 610