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