diff mbox

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

Message ID 1346453055-30888-5-git-send-email-marex@denx.de
State Superseded
Delegated to: Marek Vasut
Headers show

Commit Message

Marek Vasut Aug. 31, 2012, 10:44 p.m. UTC
Add stdio_fd_to_name() function, which convers the STDIO FD number
to a proper name.

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

Patch

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