
Wolfgang,
silent console output is currently implemented by assigning nulldev as output device. This is a bit overcomplicated, since there is also GD_FLG_SILENT flag.
Patch bellow tries to simplify silencing console by honouring GD_FLG_SILENT in console output functions, so there is no need to mess with output device. Comments?
Best regards, ladis
Signed-off-by: Ladislav Michl ladis@linux-mips.org
CHANGELOG * Silent console code simplification. Patch by Ladislav Michl, 25 Jul 2006
diff --git a/common/console.c b/common/console.c index e9f23be..d8a0cb6 100644 --- a/common/console.c +++ b/common/console.c @@ -494,13 +494,7 @@ #ifdef CONFIG_SPLASH_SCREEN /* suppress all output if splash screen is enabled and we have a bmp to display */ if (getenv("splashimage") != NULL) - outputdev = search_device (DEV_FLAGS_OUTPUT, "nulldev"); -#endif - -#ifdef CONFIG_SILENT_CONSOLE - /* Suppress all output if "silent" mode requested */ - if (gd->flags & GD_FLG_SILENT) - outputdev = search_device (DEV_FLAGS_OUTPUT, "nulldev"); + gd->flags |= GD_FLG_SILENT; #endif
/* Scan devices looking for input and output devices */ diff --git a/common/main.c b/common/main.c index ef28b3f..1ff3296 100644 --- a/common/main.c +++ b/common/main.c @@ -113,15 +113,17 @@ static __inline__ int abortboot(int boot u_int i;
#ifdef CONFIG_SILENT_CONSOLE + int silent = 0; + if (gd->flags & GD_FLG_SILENT) { - /* Restore serial console */ - console_assign (stdout, "serial"); - console_assign (stderr, "serial"); + /* Restore console */ + gd->flags &= ~GD_FLG_SILENT; + silent = 1; } #endif
# ifdef CONFIG_AUTOBOOT_PROMPT - printf (CONFIG_AUTOBOOT_PROMPT, bootdelay); + serial_printf (CONFIG_AUTOBOOT_PROMPT, bootdelay); # endif
# ifdef CONFIG_AUTOBOOT_DELAY_STR @@ -199,14 +201,8 @@ # if DEBUG_BOOTKEYS # endif
#ifdef CONFIG_SILENT_CONSOLE - if (abort) { - /* permanently enable normal console output */ - gd->flags &= ~(GD_FLG_SILENT); - } else if (gd->flags & GD_FLG_SILENT) { - /* Restore silent console */ - console_assign (stdout, "nulldev"); - console_assign (stderr, "nulldev"); - } + if (!abort && silent) + gd->flags |= GD_FLG_SILENT; #endif
return abort; @@ -223,10 +219,12 @@ static __inline__ int abortboot(int boot int abort = 0;
#ifdef CONFIG_SILENT_CONSOLE + int silent = 0; + if (gd->flags & GD_FLG_SILENT) { - /* Restore serial console */ - console_assign (stdout, "serial"); - console_assign (stderr, "serial"); + /* Restore output */ + silent = 1; + gd->flags &= ~GD_FLG_SILENT; } #endif
@@ -275,14 +273,8 @@ # endif putc ('\n');
#ifdef CONFIG_SILENT_CONSOLE - if (abort) { - /* permanently enable normal console output */ - gd->flags &= ~(GD_FLG_SILENT); - } else if (gd->flags & GD_FLG_SILENT) { - /* Restore silent console */ - console_assign (stdout, "nulldev"); - console_assign (stderr, "nulldev"); - } + if (!abort && silent) + gd->flags |= GD_FLG_SILENT; #endif
return abort;