kconfig: speed up all*config + randconfig

Drop the chatty mode when we generate the all*config, randconfig
configurations.
Ths speeds up the process considerably and noone looked
at the output anyway.
This patch uses the conf_set_all_new_symbols() function
just added to kconfig.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Roman Zippel <zippel@linux-m68k.org>

+70 -88
+70 -88
scripts/kconfig/conf.c
··· 76 76 static int conf_askvalue(struct symbol *sym, const char *def) 77 77 { 78 78 enum symbol_type type = sym_get_type(sym); 79 - tristate val; 80 79 81 80 if (!sym_has_value(sym)) 82 81 printf(_("(NEW) ")); ··· 91 92 } 92 93 93 94 switch (input_mode) { 94 - case set_no: 95 - case set_mod: 96 - case set_yes: 97 - case set_random: 98 - if (sym_has_value(sym)) { 99 - printf("%s\n", def); 100 - return 0; 101 - } 102 - break; 103 95 case ask_new: 104 96 case ask_silent: 105 97 if (sym_has_value(sym)) { ··· 117 127 return 1; 118 128 default: 119 129 ; 120 - } 121 - switch (input_mode) { 122 - case set_yes: 123 - if (sym_tristate_within_range(sym, yes)) { 124 - line[0] = 'y'; 125 - line[1] = '\n'; 126 - line[2] = 0; 127 - break; 128 - } 129 - case set_mod: 130 - if (type == S_TRISTATE) { 131 - if (sym_tristate_within_range(sym, mod)) { 132 - line[0] = 'm'; 133 - line[1] = '\n'; 134 - line[2] = 0; 135 - break; 136 - } 137 - } else { 138 - if (sym_tristate_within_range(sym, yes)) { 139 - line[0] = 'y'; 140 - line[1] = '\n'; 141 - line[2] = 0; 142 - break; 143 - } 144 - } 145 - case set_no: 146 - if (sym_tristate_within_range(sym, no)) { 147 - line[0] = 'n'; 148 - line[1] = '\n'; 149 - line[2] = 0; 150 - break; 151 - } 152 - case set_random: 153 - do { 154 - val = (tristate)(rand() % 3); 155 - } while (!sym_tristate_within_range(sym, val)); 156 - switch (val) { 157 - case no: line[0] = 'n'; break; 158 - case mod: line[0] = 'm'; break; 159 - case yes: line[0] = 'y'; break; 160 - } 161 - line[1] = '\n'; 162 - line[2] = 0; 163 - break; 164 - default: 165 - break; 166 130 } 167 131 printf("%s", line); 168 132 return 1; ··· 318 374 else 319 375 continue; 320 376 break; 321 - case set_random: 322 - if (is_new) 323 - def = (rand() % cnt) + 1; 324 377 case set_default: 325 - case set_yes: 326 - case set_mod: 327 - case set_no: 328 378 cnt = def; 329 379 printf("%d\n", cnt); 380 + break; 381 + default: 330 382 break; 331 383 } 332 384 ··· 434 494 check_conf(child); 435 495 } 436 496 497 + static void conf_do_update(void) 498 + { 499 + /* Update until a loop caused no more changes */ 500 + do { 501 + conf_cnt = 0; 502 + check_conf(&rootmenu); 503 + } while (conf_cnt); 504 + } 505 + 506 + static int conf_silent_update(void) 507 + { 508 + const char *name; 509 + 510 + if (conf_get_changed()) { 511 + name = getenv("KCONFIG_NOSILENTUPDATE"); 512 + if (name && *name) { 513 + fprintf(stderr, 514 + _("\n*** Kernel configuration requires explicit update.\n\n")); 515 + return 1; 516 + } 517 + conf_do_update(); 518 + } 519 + return 0; 520 + } 521 + 522 + static int conf_update(void) 523 + { 524 + rootEntry = &rootmenu; 525 + conf(&rootmenu); 526 + if (input_mode == ask_all) { 527 + input_mode = ask_silent; 528 + valid_stdin = 1; 529 + } 530 + conf_do_update(); 531 + return 0; 532 + } 533 + 437 534 int main(int ac, char **av) 438 535 { 439 536 int opt; ··· 576 599 default: 577 600 break; 578 601 } 579 - 580 - if (input_mode != ask_silent) { 581 - rootEntry = &rootmenu; 582 - conf(&rootmenu); 583 - if (input_mode == ask_all) { 584 - input_mode = ask_silent; 585 - valid_stdin = 1; 586 - } 587 - } else if (conf_get_changed()) { 588 - name = getenv("KCONFIG_NOSILENTUPDATE"); 589 - if (name && *name) { 590 - fprintf(stderr, _("\n*** Kernel configuration requires explicit update.\n\n")); 591 - return 1; 592 - } 593 - } else 594 - goto skip_check; 595 - 596 - do { 597 - conf_cnt = 0; 598 - check_conf(&rootmenu); 599 - } while (conf_cnt); 600 - if (conf_write(NULL)) { 601 - fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); 602 - return 1; 602 + switch (input_mode) { 603 + case set_no: 604 + conf_set_all_new_symbols(def_no); 605 + break; 606 + case set_yes: 607 + conf_set_all_new_symbols(def_yes); 608 + break; 609 + case set_mod: 610 + conf_set_all_new_symbols(def_mod); 611 + break; 612 + case set_random: 613 + conf_set_all_new_symbols(def_random); 614 + break; 615 + case ask_silent: 616 + if (conf_silent_update()) 617 + exit(1); 618 + break; 619 + case ask_new: 620 + case ask_all: 621 + case set_default: 622 + if (conf_update()) 623 + exit(1); 624 + break; 603 625 } 604 - skip_check: 626 + 627 + if (conf_get_changed() && conf_write(NULL)) { 628 + fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); 629 + exit(1); 630 + } 631 + /* ask_silent is used during the build so we shall update autoconf. 632 + * All other commands are only used to generate a config. 633 + */ 605 634 if (input_mode == ask_silent && conf_write_autoconf()) { 606 635 fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); 607 636 return 1; 608 637 } 609 - 610 638 return 0; 611 639 }