[U-Boot] [PATCH 4/6] stdio: dm: Add stdio_fd_to_name() call

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


Add stdio_fd_to_name() function, which convers the STDIO FD number
to a proper name.

Signed-off-by: Marek Vasut <marex at denx.de>
Cc: Wolfgang Denk <wd at denx.de>
---
 common/stdio.c      |   12 ++++++++++++
 include/stdio_dev.h |    1 +
 2 files changed, 13 insertions(+)

diff --git a/common/stdio.c b/common/stdio.c
index ba5e2fc..0e917fd 100644
--- a/common/stdio.c
+++ b/common/stdio.c
@@ -166,6 +166,18 @@ struct stdio_dev* stdio_clone(struct stdio_dev *dev)
 	return _dev;
 }
 
+const char *stdio_fd_to_name(int ioe)
+{
+	switch (ioe) {
+	case stdin:
+	case stdout:
+	case stderr:
+		return stdio_names[ioe];
+	default:
+		return NULL;
+	}
+}
+
 int stdio_register (struct stdio_dev * dev)
 {
 	struct stdio_dev *_dev;
diff --git a/include/stdio_dev.h b/include/stdio_dev.h
index 554708a..7299735 100644
--- a/include/stdio_dev.h
+++ b/include/stdio_dev.h
@@ -98,6 +98,7 @@ struct list_head* stdio_get_list(void);
 struct stdio_dev* stdio_get_by_name(const char* name);
 struct stdio_dev *stdio_get_fd(int ioe);
 int stdio_set_fd(int ioe, struct stdio_dev *dev);
+const char *stdio_fd_to_name(int ioe);
 struct stdio_dev* stdio_clone(struct stdio_dev *dev);
 
 #ifdef CONFIG_ARM_DCC_MULTI
-- 
1.7.10.4



More information about the U-Boot mailing list