diff mbox

[U-Boot,v3,12/54] sandbox: Drop special-case sandbox console code

Message ID 1435095556-15924-13-git-send-email-sjg@chromium.org
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass June 23, 2015, 9:38 p.m. UTC
At present printf() skips output if it can see there is no console. This
is really just an optimisation, and is not necessary. Also it is currently
incorrect in some cases. Rather than update the logic, just remove it so
that we don't need to keep it in sync.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v3: None
Changes in v2: None

 common/console.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Comments

Simon Glass July 17, 2015, 11:56 p.m. UTC | #1
On 23 June 2015 at 15:38, Simon Glass <sjg@chromium.org> wrote:
> At present printf() skips output if it can see there is no console. This
> is really just an optimisation, and is not necessary. Also it is currently
> incorrect in some cases. Rather than update the logic, just remove it so
> that we don't need to keep it in sync.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v3: None
> Changes in v2: None
>
>  common/console.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)

Applied to u-boot-dm.
diff mbox

Patch

diff --git a/common/console.c b/common/console.c
index acad8bd..ace206c 100644
--- a/common/console.c
+++ b/common/console.c
@@ -456,6 +456,7 @@  static inline void print_pre_console_buffer(int flushpoint) {}
 void putc(const char c)
 {
 #ifdef CONFIG_SANDBOX
+	/* sandbox can send characters to stdout before it has a console */
 	if (!gd || !(gd->flags & GD_FLG_SERIAL_READY)) {
 		os_putc(c);
 		return;
@@ -540,11 +541,6 @@  int printf(const char *fmt, ...)
 	uint i;
 	char printbuffer[CONFIG_SYS_PBSIZE];
 
-#if !defined(CONFIG_SANDBOX) && !defined(CONFIG_PRE_CONSOLE_BUFFER)
-	if (!gd->have_console)
-		return 0;
-#endif
-
 	va_start(args, fmt);
 
 	/* For this to work, printbuffer must be larger than