]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
kconfig: speed up all*config + randconfig
authorSam Ravnborg <sam@ravnborg.org>
Mon, 30 Jun 2008 20:45:38 +0000 (22:45 +0200)
committerSam Ravnborg <sam@ravnborg.org>
Fri, 25 Jul 2008 20:12:49 +0000 (22:12 +0200)
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>
scripts/kconfig/conf.c

index fda63136ae6809512c6d84ab5c11d1497eee3bc5..bd2a27e1967aca1baaa1a71d970e30bc2ff0029d 100644 (file)
@@ -76,7 +76,6 @@ static void check_stdin(void)
 static int conf_askvalue(struct symbol *sym, const char *def)
 {
        enum symbol_type type = sym_get_type(sym);
-       tristate val;
 
        if (!sym_has_value(sym))
                printf(_("(NEW) "));
@@ -92,15 +91,6 @@ static int conf_askvalue(struct symbol *sym, const char *def)
        }
 
        switch (input_mode) {
-       case set_no:
-       case set_mod:
-       case set_yes:
-       case set_random:
-               if (sym_has_value(sym)) {
-                       printf("%s\n", def);
-                       return 0;
-               }
-               break;
        case ask_new:
        case ask_silent:
                if (sym_has_value(sym)) {
@@ -128,52 +118,6 @@ static int conf_askvalue(struct symbol *sym, const char *def)
        default:
                ;
        }
-       switch (input_mode) {
-       case set_yes:
-               if (sym_tristate_within_range(sym, yes)) {
-                       line[0] = 'y';
-                       line[1] = '\n';
-                       line[2] = 0;
-                       break;
-               }
-       case set_mod:
-               if (type == S_TRISTATE) {
-                       if (sym_tristate_within_range(sym, mod)) {
-                               line[0] = 'm';
-                               line[1] = '\n';
-                               line[2] = 0;
-                               break;
-                       }
-               } else {
-                       if (sym_tristate_within_range(sym, yes)) {
-                               line[0] = 'y';
-                               line[1] = '\n';
-                               line[2] = 0;
-                               break;
-                       }
-               }
-       case set_no:
-               if (sym_tristate_within_range(sym, no)) {
-                       line[0] = 'n';
-                       line[1] = '\n';
-                       line[2] = 0;
-                       break;
-               }
-       case set_random:
-               do {
-                       val = (tristate)(rand() % 3);
-               } while (!sym_tristate_within_range(sym, val));
-               switch (val) {
-               case no: line[0] = 'n'; break;
-               case mod: line[0] = 'm'; break;
-               case yes: line[0] = 'y'; break;
-               }
-               line[1] = '\n';
-               line[2] = 0;
-               break;
-       default:
-               break;
-       }
        printf("%s", line);
        return 1;
 }
@@ -374,16 +318,12 @@ static int conf_choice(struct menu *menu)
                        else
                                continue;
                        break;
-               case set_random:
-                       if (is_new)
-                               def = (rand() % cnt) + 1;
                case set_default:
-               case set_yes:
-               case set_mod:
-               case set_no:
                        cnt = def;
                        printf("%d\n", cnt);
                        break;
+               default:
+                       break;
                }
 
        conf_childs:
@@ -494,6 +434,43 @@ static void check_conf(struct menu *menu)
                check_conf(child);
 }
 
+static void conf_do_update(void)
+{
+       /* Update until a loop caused no more changes */
+       do {
+               conf_cnt = 0;
+               check_conf(&rootmenu);
+       } while (conf_cnt);
+}
+
+static int conf_silent_update(void)
+{
+       const char *name;
+
+       if (conf_get_changed()) {
+               name = getenv("KCONFIG_NOSILENTUPDATE");
+               if (name && *name) {
+                       fprintf(stderr,
+                       _("\n*** Kernel configuration requires explicit update.\n\n"));
+                       return 1;
+               }
+               conf_do_update();
+       }
+       return 0;
+}
+
+static int conf_update(void)
+{
+       rootEntry = &rootmenu;
+       conf(&rootmenu);
+       if (input_mode == ask_all) {
+               input_mode = ask_silent;
+               valid_stdin = 1;
+       }
+       conf_do_update();
+       return 0;
+}
+
 int main(int ac, char **av)
 {
        int opt;
@@ -599,36 +576,41 @@ int main(int ac, char **av)
        default:
                break;
        }
+       switch (input_mode) {
+       case set_no:
+               conf_set_all_new_symbols(def_no);
+               break;
+       case set_yes:
+               conf_set_all_new_symbols(def_yes);
+               break;
+       case set_mod:
+               conf_set_all_new_symbols(def_mod);
+               break;
+       case set_random:
+               conf_set_all_new_symbols(def_random);
+               break;
+       case ask_silent:
+               if (conf_silent_update())
+                       exit(1);
+               break;
+       case ask_new:
+       case ask_all:
+       case set_default:
+               if (conf_update())
+                       exit(1);
+               break;
+       }
 
-       if (input_mode != ask_silent) {
-               rootEntry = &rootmenu;
-               conf(&rootmenu);
-               if (input_mode == ask_all) {
-                       input_mode = ask_silent;
-                       valid_stdin = 1;
-               }
-       } else if (conf_get_changed()) {
-               name = getenv("KCONFIG_NOSILENTUPDATE");
-               if (name && *name) {
-                       fprintf(stderr, _("\n*** Kernel configuration requires explicit update.\n\n"));
-                       return 1;
-               }
-       } else
-               goto skip_check;
-
-       do {
-               conf_cnt = 0;
-               check_conf(&rootmenu);
-       } while (conf_cnt);
-       if (conf_write(NULL)) {
+       if (conf_get_changed() && conf_write(NULL)) {
                fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
-               return 1;
+               exit(1);
        }
-skip_check:
+       /* ask_silent is used during the build so we shall update autoconf.
+        * All other commands are only used to generate a config.
+        */
        if (input_mode == ask_silent && conf_write_autoconf()) {
                fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
                return 1;
        }
-
        return 0;
 }