X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=common%2Fautoboot.c;h=c52bad84a4d0b8f89170ad0735379ea2c8034a23;hb=19e8649e59f5632792ecccbf04a2401eddb03e44;hp=35deece7f7e59bb137930cc0afb886f7dade17d6;hpb=2fbb8462b0e18893b4b739705db047ffda82d4fc;p=oweals%2Fu-boot.git diff --git a/common/autoboot.c b/common/autoboot.c index 35deece7f7..c52bad84a4 100644 --- a/common/autoboot.c +++ b/common/autoboot.c @@ -182,14 +182,11 @@ static int passwd_abort(uint64_t etime) * Watch for 'delay' seconds for autoboot stop or autoboot delay string. * returns: 0 - no key string, allow autoboot 1 - got key string, abort */ -static int abortboot_keyed(int bootdelay) +static int __abortboot(int bootdelay) { int abort; uint64_t etime = endtick(bootdelay); - if (bootdelay < 0) - return 0; - # ifdef CONFIG_AUTOBOOT_PROMPT /* * CONFIG_AUTOBOOT_PROMPT includes the %d for all boards. @@ -202,11 +199,6 @@ static int abortboot_keyed(int bootdelay) if (!abort) debug_bootkeys("key timeout\n"); -#ifdef CONFIG_SILENT_CONSOLE - if (abort) - gd->flags &= ~GD_FLG_SILENT; -#endif - return abort; } @@ -216,7 +208,7 @@ static int abortboot_keyed(int bootdelay) static int menukey; #endif -static int abortboot_normal(int bootdelay) +static int __abortboot(int bootdelay) { int abort = 0; unsigned long ts; @@ -224,20 +216,16 @@ static int abortboot_normal(int bootdelay) #ifdef CONFIG_MENUPROMPT printf(CONFIG_MENUPROMPT); #else - if (bootdelay >= 0) - printf("Hit any key to stop autoboot: %2d ", bootdelay); + printf("Hit any key to stop autoboot: %2d ", bootdelay); #endif /* * Check if key already pressed - * Don't check if bootdelay < 0 */ - if (bootdelay >= 0) { - if (tstc()) { /* we got a key press */ - (void) getc(); /* consume input */ - puts("\b\b\b 0"); - abort = 1; /* don't auto boot */ - } + if (tstc()) { /* we got a key press */ + (void) getc(); /* consume input */ + puts("\b\b\b 0"); + abort = 1; /* don't auto boot */ } while ((bootdelay > 0) && (!abort)) { @@ -263,22 +251,23 @@ static int abortboot_normal(int bootdelay) putc('\n'); -#ifdef CONFIG_SILENT_CONSOLE - if (abort) - gd->flags &= ~GD_FLG_SILENT; -#endif - return abort; } # endif /* CONFIG_AUTOBOOT_KEYED */ static int abortboot(int bootdelay) { -#ifdef CONFIG_AUTOBOOT_KEYED - return abortboot_keyed(bootdelay); -#else - return abortboot_normal(bootdelay); + int abort = 0; + + if (bootdelay >= 0) + abort = __abortboot(bootdelay); + +#ifdef CONFIG_SILENT_CONSOLE + if (abort) + gd->flags &= ~GD_FLG_SILENT; #endif + + return abort; } static void process_fdt_options(const void *blob)