diff options
| author | Ingo Molnar <mingo@elte.hu> | 2008-07-28 18:07:55 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2008-07-28 18:07:55 -0400 |
| commit | cb28a1bbdb4790378e7366d6c9ee1d2340b84f92 (patch) | |
| tree | 316436f77dac75335fd2c3ef5f109e71606c50d3 /scripts/kconfig | |
| parent | b6d4f7e3ef25beb8c658c97867d98883e69dc544 (diff) | |
| parent | f934fb19ef34730263e6afc01e8ec27a8a71470f (diff) | |
Merge branch 'linus' into core/generic-dma-coherent
Conflicts:
arch/x86/Kconfig
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'scripts/kconfig')
| -rw-r--r-- | scripts/kconfig/conf.c | 161 | ||||
| -rw-r--r-- | scripts/kconfig/confdata.c | 70 | ||||
| -rw-r--r-- | scripts/kconfig/lkc.h | 9 |
3 files changed, 148 insertions, 92 deletions
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index fda63136ae68..9fba838c7069 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c | |||
| @@ -76,7 +76,6 @@ static void check_stdin(void) | |||
| 76 | static int conf_askvalue(struct symbol *sym, const char *def) | 76 | static int conf_askvalue(struct symbol *sym, const char *def) |
| 77 | { | 77 | { |
| 78 | enum symbol_type type = sym_get_type(sym); | 78 | enum symbol_type type = sym_get_type(sym); |
| 79 | tristate val; | ||
| 80 | 79 | ||
| 81 | if (!sym_has_value(sym)) | 80 | if (!sym_has_value(sym)) |
| 82 | printf(_("(NEW) ")); | 81 | printf(_("(NEW) ")); |
| @@ -92,15 +91,6 @@ static int conf_askvalue(struct symbol *sym, const char *def) | |||
| 92 | } | 91 | } |
| 93 | 92 | ||
| 94 | switch (input_mode) { | 93 | switch (input_mode) { |
| 95 | case set_no: | ||
| 96 | case set_mod: | ||
| 97 | case set_yes: | ||
| 98 | case set_random: | ||
| 99 | if (sym_has_value(sym)) { | ||
| 100 | printf("%s\n", def); | ||
| 101 | return 0; | ||
| 102 | } | ||
| 103 | break; | ||
| 104 | case ask_new: | 94 | case ask_new: |
| 105 | case ask_silent: | 95 | case ask_silent: |
| 106 | if (sym_has_value(sym)) { | 96 | if (sym_has_value(sym)) { |
| @@ -112,9 +102,6 @@ static int conf_askvalue(struct symbol *sym, const char *def) | |||
| 112 | fflush(stdout); | 102 | fflush(stdout); |
| 113 | fgets(line, 128, stdin); | 103 | fgets(line, 128, stdin); |
| 114 | return 1; | 104 | return 1; |
| 115 | case set_default: | ||
| 116 | printf("%s\n", def); | ||
| 117 | return 1; | ||
| 118 | default: | 105 | default: |
| 119 | break; | 106 | break; |
| 120 | } | 107 | } |
| @@ -128,52 +115,6 @@ static int conf_askvalue(struct symbol *sym, const char *def) | |||
| 128 | default: | 115 | default: |
| 129 | ; | 116 | ; |
| 130 | } | 117 | } |
| 131 | switch (input_mode) { | ||
| 132 | case set_yes: | ||
| 133 | if (sym_tristate_within_range(sym, yes)) { | ||
| 134 | line[0] = 'y'; | ||
| 135 | line[1] = '\n'; | ||
| 136 | line[2] = 0; | ||
| 137 | break; | ||
| 138 | } | ||
| 139 | case set_mod: | ||
| 140 | if (type == S_TRISTATE) { | ||
| 141 | if (sym_tristate_within_range(sym, mod)) { | ||
| 142 | line[0] = 'm'; | ||
| 143 | line[1] = '\n'; | ||
| 144 | line[2] = 0; | ||
| 145 | break; | ||
| 146 | } | ||
| 147 | } else { | ||
| 148 | if (sym_tristate_within_range(sym, yes)) { | ||
| 149 | line[0] = 'y'; | ||
| 150 | line[1] = '\n'; | ||
| 151 | line[2] = 0; | ||
| 152 | break; | ||
| 153 | } | ||
| 154 | } | ||
| 155 | case set_no: | ||
| 156 | if (sym_tristate_within_range(sym, no)) { | ||
| 157 | line[0] = 'n'; | ||
| 158 | line[1] = '\n'; | ||
| 159 | line[2] = 0; | ||
| 160 | break; | ||
| 161 | } | ||
| 162 | case set_random: | ||
| 163 | do { | ||
| 164 | val = (tristate)(rand() % 3); | ||
| 165 | } while (!sym_tristate_within_range(sym, val)); | ||
| 166 | switch (val) { | ||
| 167 | case no: line[0] = 'n'; break; | ||
| 168 | case mod: line[0] = 'm'; break; | ||
| 169 | case yes: line[0] = 'y'; break; | ||
| 170 | } | ||
| 171 | line[1] = '\n'; | ||
| 172 | line[2] = 0; | ||
| 173 | break; | ||
| 174 | default: | ||
| 175 | break; | ||
| 176 | } | ||
| 177 | printf("%s", line); | 118 | printf("%s", line); |
| 178 | return 1; | 119 | return 1; |
| 179 | } | 120 | } |
| @@ -374,15 +315,7 @@ static int conf_choice(struct menu *menu) | |||
| 374 | else | 315 | else |
| 375 | continue; | 316 | continue; |
| 376 | break; | 317 | break; |
| 377 | case set_random: | 318 | default: |
| 378 | if (is_new) | ||
| 379 | def = (rand() % cnt) + 1; | ||
| 380 | case set_default: | ||
| 381 | case set_yes: | ||
| 382 | case set_mod: | ||
| 383 | case set_no: | ||
| 384 | cnt = def; | ||
| 385 | printf("%d\n", cnt); | ||
| 386 | break; | 319 | break; |
| 387 | } | 320 | } |
| 388 | 321 | ||
| @@ -494,6 +427,43 @@ static void check_conf(struct menu *menu) | |||
| 494 | check_conf(child); | 427 | check_conf(child); |
| 495 | } | 428 | } |
| 496 | 429 | ||
| 430 | static void conf_do_update(void) | ||
| 431 | { | ||
| 432 | /* Update until a loop caused no more changes */ | ||
| 433 | do { | ||
| 434 | conf_cnt = 0; | ||
| 435 | check_conf(&rootmenu); | ||
| 436 | } while (conf_cnt); | ||
| 437 | } | ||
| 438 | |||
| 439 | static int conf_silent_update(void) | ||
| 440 | { | ||
| 441 | const char *name; | ||
| 442 | |||
| 443 | if (conf_get_changed()) { | ||
| 444 | name = getenv("KCONFIG_NOSILENTUPDATE"); | ||
| 445 | if (name && *name) { | ||
| 446 | fprintf(stderr, | ||
| 447 | _("\n*** Kernel configuration requires explicit update.\n\n")); | ||
| 448 | return 1; | ||
| 449 | } | ||
| 450 | conf_do_update(); | ||
| 451 | } | ||
| 452 | return 0; | ||
| 453 | } | ||
| 454 | |||
| 455 | static int conf_update(void) | ||
| 456 | { | ||
| 457 | rootEntry = &rootmenu; | ||
| 458 | conf(&rootmenu); | ||
| 459 | if (input_mode == ask_all) { | ||
| 460 | input_mode = ask_silent; | ||
| 461 | valid_stdin = 1; | ||
| 462 | } | ||
| 463 | conf_do_update(); | ||
| 464 | return 0; | ||
| 465 | } | ||
| 466 | |||
| 497 | int main(int ac, char **av) | 467 | int main(int ac, char **av) |
| 498 | { | 468 | { |
| 499 | int opt; | 469 | int opt; |
| @@ -599,36 +569,43 @@ int main(int ac, char **av) | |||
| 599 | default: | 569 | default: |
| 600 | break; | 570 | break; |
| 601 | } | 571 | } |
| 572 | switch (input_mode) { | ||
| 573 | case set_no: | ||
| 574 | conf_set_all_new_symbols(def_no); | ||
| 575 | break; | ||
| 576 | case set_yes: | ||
| 577 | conf_set_all_new_symbols(def_yes); | ||
| 578 | break; | ||
| 579 | case set_mod: | ||
| 580 | conf_set_all_new_symbols(def_mod); | ||
| 581 | break; | ||
| 582 | case set_random: | ||
| 583 | conf_set_all_new_symbols(def_random); | ||
| 584 | break; | ||
| 585 | case set_default: | ||
| 586 | conf_set_all_new_symbols(def_default); | ||
| 587 | break; | ||
| 588 | case ask_silent: | ||
| 589 | case ask_new: | ||
| 590 | if (conf_silent_update()) | ||
| 591 | exit(1); | ||
| 592 | break; | ||
| 593 | case ask_all: | ||
| 594 | if (conf_update()) | ||
| 595 | exit(1); | ||
| 596 | break; | ||
| 597 | } | ||
| 602 | 598 | ||
| 603 | if (input_mode != ask_silent) { | 599 | if (conf_get_changed() && conf_write(NULL)) { |
| 604 | rootEntry = &rootmenu; | ||
| 605 | conf(&rootmenu); | ||
| 606 | if (input_mode == ask_all) { | ||
| 607 | input_mode = ask_silent; | ||
| 608 | valid_stdin = 1; | ||
| 609 | } | ||
| 610 | } else if (conf_get_changed()) { | ||
| 611 | name = getenv("KCONFIG_NOSILENTUPDATE"); | ||
| 612 | if (name && *name) { | ||
| 613 | fprintf(stderr, _("\n*** Kernel configuration requires explicit update.\n\n")); | ||
| 614 | return 1; | ||
| 615 | } | ||
| 616 | } else | ||
| 617 | goto skip_check; | ||
| 618 | |||
| 619 | do { | ||
| 620 | conf_cnt = 0; | ||
| 621 | check_conf(&rootmenu); | ||
| 622 | } while (conf_cnt); | ||
| 623 | if (conf_write(NULL)) { | ||
| 624 | fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); | 600 | fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); |
| 625 | return 1; | 601 | exit(1); |
| 626 | } | 602 | } |
| 627 | skip_check: | 603 | /* ask_silent is used during the build so we shall update autoconf. |
| 604 | * All other commands are only used to generate a config. | ||
| 605 | */ | ||
| 628 | if (input_mode == ask_silent && conf_write_autoconf()) { | 606 | if (input_mode == ask_silent && conf_write_autoconf()) { |
| 629 | fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); | 607 | fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); |
| 630 | return 1; | 608 | return 1; |
| 631 | } | 609 | } |
| 632 | |||
| 633 | return 0; | 610 | return 0; |
| 634 | } | 611 | } |
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index ee5fe943d58d..07597611cc50 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c | |||
| @@ -812,3 +812,73 @@ void conf_set_changed_callback(void (*fn)(void)) | |||
| 812 | { | 812 | { |
| 813 | conf_changed_callback = fn; | 813 | conf_changed_callback = fn; |
| 814 | } | 814 | } |
| 815 | |||
| 816 | |||
| 817 | void conf_set_all_new_symbols(enum conf_def_mode mode) | ||
| 818 | { | ||
| 819 | struct symbol *sym, *csym; | ||
| 820 | struct property *prop; | ||
| 821 | struct expr *e; | ||
| 822 | int i, cnt, def; | ||
| 823 | |||
| 824 | for_all_symbols(i, sym) { | ||
| 825 | if (sym_has_value(sym)) | ||
| 826 | continue; | ||
| 827 | switch (sym_get_type(sym)) { | ||
| 828 | case S_BOOLEAN: | ||
| 829 | case S_TRISTATE: | ||
| 830 | switch (mode) { | ||
| 831 | case def_yes: | ||
| 832 | sym->def[S_DEF_USER].tri = yes; | ||
| 833 | break; | ||
| 834 | case def_mod: | ||
| 835 | sym->def[S_DEF_USER].tri = mod; | ||
| 836 | break; | ||
| 837 | case def_no: | ||
| 838 | sym->def[S_DEF_USER].tri = no; | ||
| 839 | break; | ||
| 840 | case def_random: | ||
| 841 | sym->def[S_DEF_USER].tri = (tristate)(rand() % 3); | ||
| 842 | break; | ||
| 843 | default: | ||
| 844 | continue; | ||
| 845 | } | ||
| 846 | if (!sym_is_choice(sym) || mode != def_random) | ||
| 847 | sym->flags |= SYMBOL_DEF_USER; | ||
| 848 | break; | ||
| 849 | default: | ||
| 850 | break; | ||
| 851 | } | ||
| 852 | |||
| 853 | } | ||
| 854 | |||
| 855 | if (modules_sym) | ||
| 856 | sym_calc_value(modules_sym); | ||
| 857 | |||
| 858 | if (mode != def_random) | ||
| 859 | return; | ||
| 860 | |||
| 861 | for_all_symbols(i, csym) { | ||
| 862 | if (sym_has_value(csym) || !sym_is_choice(csym)) | ||
| 863 | continue; | ||
| 864 | |||
| 865 | sym_calc_value(csym); | ||
| 866 | prop = sym_get_choice_prop(csym); | ||
| 867 | def = -1; | ||
| 868 | while (1) { | ||
| 869 | cnt = 0; | ||
| 870 | expr_list_for_each_sym(prop->expr, e, sym) { | ||
| 871 | if (sym->visible == no) | ||
| 872 | continue; | ||
| 873 | if (def == cnt++) { | ||
| 874 | csym->def[S_DEF_USER].val = sym; | ||
| 875 | break; | ||
| 876 | } | ||
| 877 | } | ||
| 878 | if (def >= 0 || cnt < 2) | ||
| 879 | break; | ||
| 880 | def = (rand() % cnt) + 1; | ||
| 881 | } | ||
| 882 | csym->flags |= SYMBOL_DEF_USER; | ||
| 883 | } | ||
| 884 | } | ||
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index 96521cb087ec..4a9af6f7886b 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h | |||
| @@ -42,6 +42,14 @@ extern "C" { | |||
| 42 | #define TF_PARAM 0x0002 | 42 | #define TF_PARAM 0x0002 |
| 43 | #define TF_OPTION 0x0004 | 43 | #define TF_OPTION 0x0004 |
| 44 | 44 | ||
| 45 | enum conf_def_mode { | ||
| 46 | def_default, | ||
| 47 | def_yes, | ||
| 48 | def_mod, | ||
| 49 | def_no, | ||
| 50 | def_random | ||
| 51 | }; | ||
| 52 | |||
| 45 | #define T_OPT_MODULES 1 | 53 | #define T_OPT_MODULES 1 |
| 46 | #define T_OPT_DEFCONFIG_LIST 2 | 54 | #define T_OPT_DEFCONFIG_LIST 2 |
| 47 | #define T_OPT_ENV 3 | 55 | #define T_OPT_ENV 3 |
| @@ -69,6 +77,7 @@ const char *conf_get_configname(void); | |||
| 69 | char *conf_get_default_confname(void); | 77 | char *conf_get_default_confname(void); |
| 70 | void sym_set_change_count(int count); | 78 | void sym_set_change_count(int count); |
| 71 | void sym_add_change_count(int count); | 79 | void sym_add_change_count(int count); |
| 80 | void conf_set_all_new_symbols(enum conf_def_mode mode); | ||
| 72 | 81 | ||
| 73 | /* kconfig_load.c */ | 82 | /* kconfig_load.c */ |
| 74 | void kconfig_load(void); | 83 | void kconfig_load(void); |
