From d8727713b6c6b021738a192ca524651c101df3fa Mon Sep 17 00:00:00 2001
From: Simon Glass <sjg@chromium.org>
Date: Thu, 13 Nov 2014 20:51:12 -0700
Subject: [PATCH] Fix console functions for U-Boot API

Commit 709ea54 made a subtle change to the way the U-Boot API jump table
is set up. So at present putc(), getc(), tstc() and puts() do not work
correctly from functions that use the U-Boot API.

Previously these were set to the stdio functions, but these now take a
parameter specifying which stdio device to use. Instead, we should change
them to use the global functions which do not have a parameter.

This is a slight change in behaviour. The functions will now output to
all selected stdio devices - for example putc() will output a character to
all devices selected by stdout. However in most cases there is only one,
and it isn't necessarily incorrect behaviour anyway.

The API version is not changed since it is compatible with what was there
before.

Reported-by: Martin Dorwig <dorwig@tektronik.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
---
 common/console.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/common/console.c b/common/console.c
index 4695386a33..29560c3ebe 100644
--- a/common/console.c
+++ b/common/console.c
@@ -125,12 +125,12 @@ static int console_setfile(int file, struct stdio_dev * dev)
 		 */
 		switch (file) {
 		case stdin:
-			gd->jt[XF_getc] = dev->getc;
-			gd->jt[XF_tstc] = dev->tstc;
+			gd->jt[XF_getc] = getc;
+			gd->jt[XF_tstc] = tstc;
 			break;
 		case stdout:
-			gd->jt[XF_putc] = dev->putc;
-			gd->jt[XF_puts] = dev->puts;
+			gd->jt[XF_putc] = putc;
+			gd->jt[XF_puts] = puts;
 			gd->jt[XF_printf] = printf;
 			break;
 		}
-- 
2.39.5