[U-Boot] [PATCH 5/6] stdio: dm: Use stdio_fd_to_name() call to localize stdio_names

Marek Vasut marex at denx.de
Sat Sep 1 00:44:14 CEST 2012


The stdio_names variable is no longer exported. Now it's properly
constified and accessed via stdio_fd_to_name call.

Signed-off-by: Marek Vasut <marex at denx.de>
Cc: Wolfgang Denk <wd at denx.de>
---
 common/cmd_console.c |    2 +-
 common/console.c     |    4 ++--
 common/stdio.c       |    6 +++++-
 include/stdio_dev.h  |    5 -----
 4 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/common/cmd_console.c b/common/cmd_console.c
index 343bc28..d5ffc69 100644
--- a/common/cmd_console.c
+++ b/common/cmd_console.c
@@ -53,7 +53,7 @@ int do_coninfo (cmd_tbl_t * cmd, int flag, int argc, char * const argv[])
 		for (l = 0; l < MAX_FILES; l++) {
 			sio = stdio_get_fd(l);
 			if (sio == dev)
-				printf("%s ", stdio_names[l]);
+				printf("%s ", stdio_fd_to_name(l));
 		}
 		putc ('\n');
 	}
diff --git a/common/console.c b/common/console.c
index 4a1938a..22516a5 100644
--- a/common/console.c
+++ b/common/console.c
@@ -706,7 +706,7 @@ done:
 	for (i = 0; i < 3; i++) {
 		sio = stdio_get_fd(i);
 		if (sio)
-			setenv(stdio_names[i], sio->name);
+			setenv(stdio_fd_to_name(i), sio->name);
 	}
 #endif /* CONFIG_SYS_CONSOLE_ENV_OVERWRITE */
 
@@ -777,7 +777,7 @@ int console_init_r(void)
 	for (i = 0; i < 3; i++) {
 		sio = stdio_get_fd(i);
 		if (sio)
-			setenv(stdio_names[i], sio->name);
+			setenv(stdio_fd_to_name(i), sio->name);
 	}
 
 	return 0;
diff --git a/common/stdio.c b/common/stdio.c
index 0e917fd..64ee94a 100644
--- a/common/stdio.c
+++ b/common/stdio.c
@@ -39,7 +39,11 @@ DECLARE_GLOBAL_DATA_PTR;
 
 static struct stdio_dev devs;
 static struct stdio_dev *stdio_devices[] = { NULL, NULL, NULL };
-char *stdio_names[MAX_FILES] = { "stdin", "stdout", "stderr" };
+static const char * const stdio_names[MAX_FILES] = {
+	"stdin",
+	"stdout",
+	"stderr"
+};
 
 #if defined(CONFIG_SPLASH_SCREEN) && !defined(CONFIG_SYS_DEVICE_NULLDEV)
 #define	CONFIG_SYS_DEVICE_NULLDEV	1
diff --git a/include/stdio_dev.h b/include/stdio_dev.h
index 7299735..4e4d7d5 100644
--- a/include/stdio_dev.h
+++ b/include/stdio_dev.h
@@ -81,11 +81,6 @@ typedef struct {
 } video_ext_t;
 
 /*
- * VARIABLES
- */
-extern char *stdio_names[MAX_FILES];
-
-/*
  * PROTOTYPES
  */
 int	stdio_register (struct stdio_dev * dev);
-- 
1.7.10.4



More information about the U-Boot mailing list