| 543 | } |
| 544 | |
| 545 | int conf_read(const char *name) |
| 546 | { |
| 547 | struct symbol *sym; |
| 548 | int conf_unsaved = 0; |
| 549 | int i; |
| 550 | |
| 551 | conf_set_changed(false); |
| 552 | |
| 553 | if (conf_read_simple(name, S_DEF_USER)) { |
| 554 | sym_calc_value(modules_sym); |
| 555 | return 1; |
| 556 | } |
| 557 | |
| 558 | sym_calc_value(modules_sym); |
| 559 | |
| 560 | for_all_symbols(i, sym) { |
| 561 | sym_calc_value(sym); |
| 562 | if (sym_is_choice(sym) || (sym->flags & SYMBOL_NO_WRITE)) |
| 563 | continue; |
| 564 | if (sym_has_value(sym) && (sym->flags & SYMBOL_WRITE)) { |
| 565 | /* check that calculated value agrees with saved value */ |
| 566 | switch (sym->type) { |
| 567 | case S_BOOLEAN: |
| 568 | case S_TRISTATE: |
| 569 | if (sym->def[S_DEF_USER].tri == sym_get_tristate_value(sym)) |
| 570 | continue; |
| 571 | break; |
| 572 | default: |
| 573 | if (!strcmp(sym->curr.val, sym->def[S_DEF_USER].val)) |
| 574 | continue; |
| 575 | break; |
| 576 | } |
| 577 | } else if (!sym_has_value(sym) && !(sym->flags & SYMBOL_WRITE)) |
| 578 | /* no previous value and not saved */ |
| 579 | continue; |
| 580 | conf_unsaved++; |
| 581 | /* maybe print value in verbose mode... */ |
| 582 | } |
| 583 | |
| 584 | for_all_symbols(i, sym) { |
| 585 | if (sym_has_value(sym) && !sym_is_choice_value(sym)) { |
| 586 | /* Reset values of generates values, so they'll appear |
| 587 | * as new, if they should become visible, but that |
| 588 | * doesn't quite work if the Kconfig and the saved |
| 589 | * configuration disagree. |
| 590 | */ |
| 591 | if (sym->visible == no && !conf_unsaved) |
| 592 | sym->flags &= ~SYMBOL_DEF_USER; |
| 593 | switch (sym->type) { |
| 594 | case S_STRING: |
| 595 | case S_INT: |
| 596 | case S_HEX: |
| 597 | /* Reset a string value if it's out of range */ |
| 598 | if (sym_string_within_range(sym, sym->def[S_DEF_USER].val)) |
| 599 | break; |
| 600 | sym->flags &= ~(SYMBOL_VALID|SYMBOL_DEF_USER); |
| 601 | conf_unsaved++; |
| 602 | break; |
no test coverage detected