summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-06-08 13:58:28 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2015-06-09 09:22:13 +0200
commite53e7218ad003c0fb48a02ce860c49e4220845d8 (patch)
tree2032d6eaaa3727659774344404e868d11c85355e /common
parent56b2fe72e856fe210ba1cdb5c154244a6d2d96ab (diff)
downloadbarebox-e53e7218ad003c0fb48a02ce860c49e4220845d8.tar.gz
barebox-e53e7218ad003c0fb48a02ce860c49e4220845d8.tar.xz
console: Add console_get_by_name
Commands like loadx/loady wish to find a console device by its name. Add a function for this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r--common/console_common.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/common/console_common.c b/common/console_common.c
index 41a6929dba..1e362ab4e4 100644
--- a/common/console_common.c
+++ b/common/console_common.c
@@ -260,6 +260,19 @@ struct console_device *console_get_by_dev(struct device_d *dev)
}
EXPORT_SYMBOL(console_get_by_dev);
+struct console_device *console_get_by_name(const char *name)
+{
+ struct console_device *cdev;
+
+ for_each_console(cdev) {
+ if (!strcmp(cdev->devname, name))
+ return cdev;
+ }
+
+ return NULL;
+}
+EXPORT_SYMBOL(console_get_by_name);
+
/*
* @brief returns current used console device
*