From: Ladislav Michl <MICHL@2n.cz>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] simplify silent console
Date: Tue, 25 Jul 2006 17:30:03 +0200 [thread overview]
Message-ID: <20060725153003.GA21533@orphique> (raw)
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;
next reply other threads:[~2006-07-25 15:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-25 15:30 Ladislav Michl [this message]
2006-10-30 8:25 ` [U-Boot-Users] [PATCH] simplify silent console Stefan Roese
2007-04-24 12:02 ` Ladislav Michl
2007-04-24 12:10 ` Wolfgang Denk
2007-04-24 12:25 ` Ladislav Michl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060725153003.GA21533@orphique \
--to=michl@2n.cz \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox