aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/symbol.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/kconfig/symbol.c')
-rw-r--r--scripts/kconfig/symbol.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 3d7877afccd5..ee225ced2ce4 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -15,15 +15,15 @@
15struct symbol symbol_yes = { 15struct symbol symbol_yes = {
16 .name = "y", 16 .name = "y",
17 .curr = { "y", yes }, 17 .curr = { "y", yes },
18 .flags = SYMBOL_YES|SYMBOL_VALID, 18 .flags = SYMBOL_CONST|SYMBOL_VALID,
19}, symbol_mod = { 19}, symbol_mod = {
20 .name = "m", 20 .name = "m",
21 .curr = { "m", mod }, 21 .curr = { "m", mod },
22 .flags = SYMBOL_MOD|SYMBOL_VALID, 22 .flags = SYMBOL_CONST|SYMBOL_VALID,
23}, symbol_no = { 23}, symbol_no = {
24 .name = "n", 24 .name = "n",
25 .curr = { "n", no }, 25 .curr = { "n", no },
26 .flags = SYMBOL_NO|SYMBOL_VALID, 26 .flags = SYMBOL_CONST|SYMBOL_VALID,
27}, symbol_empty = { 27}, symbol_empty = {
28 .name = "", 28 .name = "",
29 .curr = { "", no }, 29 .curr = { "", no },
@@ -31,6 +31,7 @@ struct symbol symbol_yes = {
31}; 31};
32 32
33int sym_change_count; 33int sym_change_count;
34struct symbol *sym_defconfig_list;
34struct symbol *modules_sym; 35struct symbol *modules_sym;
35tristate modules_val; 36tristate modules_val;
36 37
@@ -227,7 +228,7 @@ static struct symbol *sym_calc_choice(struct symbol *sym)
227 struct expr *e; 228 struct expr *e;
228 229
229 /* is the user choice visible? */ 230 /* is the user choice visible? */
230 def_sym = sym->user.val; 231 def_sym = sym->def[S_DEF_USER].val;
231 if (def_sym) { 232 if (def_sym) {
232 sym_calc_visibility(def_sym); 233 sym_calc_visibility(def_sym);
233 if (def_sym->visible != no) 234 if (def_sym->visible != no)
@@ -306,7 +307,7 @@ void sym_calc_value(struct symbol *sym)
306 } else if (E_OR(sym->visible, sym->rev_dep.tri) != no) { 307 } else if (E_OR(sym->visible, sym->rev_dep.tri) != no) {
307 sym->flags |= SYMBOL_WRITE; 308 sym->flags |= SYMBOL_WRITE;
308 if (sym_has_value(sym)) 309 if (sym_has_value(sym))
309 newval.tri = sym->user.tri; 310 newval.tri = sym->def[S_DEF_USER].tri;
310 else if (!sym_is_choice(sym)) { 311 else if (!sym_is_choice(sym)) {
311 prop = sym_get_default_prop(sym); 312 prop = sym_get_default_prop(sym);
312 if (prop) 313 if (prop)
@@ -329,7 +330,7 @@ void sym_calc_value(struct symbol *sym)
329 if (sym->visible != no) { 330 if (sym->visible != no) {
330 sym->flags |= SYMBOL_WRITE; 331 sym->flags |= SYMBOL_WRITE;
331 if (sym_has_value(sym)) { 332 if (sym_has_value(sym)) {
332 newval.val = sym->user.val; 333 newval.val = sym->def[S_DEF_USER].val;
333 break; 334 break;
334 } 335 }
335 } 336 }
@@ -352,10 +353,13 @@ void sym_calc_value(struct symbol *sym)
352 sym->curr.val = sym_calc_choice(sym); 353 sym->curr.val = sym_calc_choice(sym);
353 sym_validate_range(sym); 354 sym_validate_range(sym);
354 355
355 if (memcmp(&oldval, &sym->curr, sizeof(oldval))) 356 if (memcmp(&oldval, &sym->curr, sizeof(oldval))) {
356 sym_set_changed(sym); 357 sym_set_changed(sym);
357 if (modules_sym == sym) 358 if (modules_sym == sym) {
358 modules_val = modules_sym->curr.tri; 359 sym_set_all_changed();
360 modules_val = modules_sym->curr.tri;
361 }
362 }
359 363
360 if (sym_is_choice(sym)) { 364 if (sym_is_choice(sym)) {
361 int flags = sym->flags & (SYMBOL_CHANGED | SYMBOL_WRITE); 365 int flags = sym->flags & (SYMBOL_CHANGED | SYMBOL_WRITE);
@@ -426,8 +430,8 @@ bool sym_set_tristate_value(struct symbol *sym, tristate val)
426 if (oldval != val && !sym_tristate_within_range(sym, val)) 430 if (oldval != val && !sym_tristate_within_range(sym, val))
427 return false; 431 return false;
428 432
429 if (sym->flags & SYMBOL_NEW) { 433 if (!(sym->flags & SYMBOL_DEF_USER)) {
430 sym->flags &= ~SYMBOL_NEW; 434 sym->flags |= SYMBOL_DEF_USER;
431 sym_set_changed(sym); 435 sym_set_changed(sym);
432 } 436 }
433 /* 437 /*
@@ -439,21 +443,18 @@ bool sym_set_tristate_value(struct symbol *sym, tristate val)
439 struct property *prop; 443 struct property *prop;
440 struct expr *e; 444 struct expr *e;
441 445
442 cs->user.val = sym; 446 cs->def[S_DEF_USER].val = sym;
443 cs->flags &= ~SYMBOL_NEW; 447 cs->flags |= SYMBOL_DEF_USER;
444 prop = sym_get_choice_prop(cs); 448 prop = sym_get_choice_prop(cs);
445 for (e = prop->expr; e; e = e->left.expr) { 449 for (e = prop->expr; e; e = e->left.expr) {
446 if (e->right.sym->visible != no) 450 if (e->right.sym->visible != no)
447 e->right.sym->flags &= ~SYMBOL_NEW; 451 e->right.sym->flags |= SYMBOL_DEF_USER;
448 } 452 }
449 } 453 }
450 454
451 sym->user.tri = val; 455 sym->def[S_DEF_USER].tri = val;
452 if (oldval != val) { 456 if (oldval != val)
453 sym_clear_all_valid(); 457 sym_clear_all_valid();
454 if (sym == modules_sym)
455 sym_set_all_changed();
456 }
457 458
458 return true; 459 return true;
459} 460}
@@ -591,20 +592,20 @@ bool sym_set_string_value(struct symbol *sym, const char *newval)
591 if (!sym_string_within_range(sym, newval)) 592 if (!sym_string_within_range(sym, newval))
592 return false; 593 return false;
593 594
594 if (sym->flags & SYMBOL_NEW) { 595 if (!(sym->flags & SYMBOL_DEF_USER)) {
595 sym->flags &= ~SYMBOL_NEW; 596 sym->flags |= SYMBOL_DEF_USER;
596 sym_set_changed(sym); 597 sym_set_changed(sym);
597 } 598 }
598 599
599 oldval = sym->user.val; 600 oldval = sym->def[S_DEF_USER].val;
600 size = strlen(newval) + 1; 601 size = strlen(newval) + 1;
601 if (sym->type == S_HEX && (newval[0] != '0' || (newval[1] != 'x' && newval[1] != 'X'))) { 602 if (sym->type == S_HEX && (newval[0] != '0' || (newval[1] != 'x' && newval[1] != 'X'))) {
602 size += 2; 603 size += 2;
603 sym->user.val = val = malloc(size); 604 sym->def[S_DEF_USER].val = val = malloc(size);
604 *val++ = '0'; 605 *val++ = '0';
605 *val++ = 'x'; 606 *val++ = 'x';
606 } else if (!oldval || strcmp(oldval, newval)) 607 } else if (!oldval || strcmp(oldval, newval))
607 sym->user.val = val = malloc(size); 608 sym->def[S_DEF_USER].val = val = malloc(size);
608 else 609 else
609 return true; 610 return true;
610 611
@@ -679,7 +680,6 @@ struct symbol *sym_lookup(const char *name, int isconst)
679 memset(symbol, 0, sizeof(*symbol)); 680 memset(symbol, 0, sizeof(*symbol));
680 symbol->name = new_name; 681 symbol->name = new_name;
681 symbol->type = S_UNKNOWN; 682 symbol->type = S_UNKNOWN;
682 symbol->flags = SYMBOL_NEW;
683 if (isconst) 683 if (isconst)
684 symbol->flags |= SYMBOL_CONST; 684 symbol->flags |= SYMBOL_CONST;
685 685