diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2015-06-08 13:58:28 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-06-09 09:22:13 +0200 |
commit | e53e7218ad003c0fb48a02ce860c49e4220845d8 (patch) | |
tree | 2032d6eaaa3727659774344404e868d11c85355e /common/console_common.c | |
parent | 56b2fe72e856fe210ba1cdb5c154244a6d2d96ab (diff) | |
download | barebox-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/console_common.c')
-rw-r--r-- | common/console_common.c | 13 |
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 * |