[PATCH 2/5] console: introduce console_get_by_dev
Jean-Christophe PLAGNIOL-VILLARD
plagnioj at jcrosoft.com
Thu Sep 19 09:20:23 EDT 2013
so we can get console by it's device
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
---
common/console_common.c | 13 +++++++++++++
include/console.h | 2 ++
2 files changed, 15 insertions(+)
diff --git a/common/console_common.c b/common/console_common.c
index d139d1a..24aa63e 100644
--- a/common/console_common.c
+++ b/common/console_common.c
@@ -108,3 +108,16 @@ int fputc(int fd, char c)
return 0;
}
EXPORT_SYMBOL(fputc);
+
+struct console_device *console_get_by_dev(struct device_d *dev)
+{
+ struct console_device *cdev;
+
+ for_each_console(cdev) {
+ if (cdev->dev == dev)
+ return cdev;
+ }
+
+ return NULL;
+}
+EXPORT_SYMBOL(console_get_by_dev);
diff --git a/include/console.h b/include/console.h
index 72cf99f..355e259 100644
--- a/include/console.h
+++ b/include/console.h
@@ -49,6 +49,8 @@ struct console_device {
int console_register(struct console_device *cdev);
int console_unregister(struct console_device *cdev);
+struct console_device *console_get_by_dev(struct device_d *dev);
+
extern struct list_head console_list;
#define for_each_console(console) list_for_each_entry(console, &console_list, list)
--
1.8.4.rc1
More information about the barebox
mailing list