[PATCH 4/4] Added console_event_register() and console_event_unregister() for OLPC DCON driver support
Raymond Lai
airwave209gt at gmail.com
Thu Feb 25 06:31:28 UTC 2010
From: Raymond Lai <airwave at cinderella.(none)>
The method declarations are taken from OLPC's kernel source tree.
Signed-off-by: Raymond Lai <airwave209gt at gmail.com>
---
drivers/char/vt_ioctl.c | 3 +++
include/linux/vt_kern.h | 19 +++++++++++++++++++
2 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c
index 95189f2..0fbd901 100644
--- a/drivers/char/vt_ioctl.c
+++ b/drivers/char/vt_ioctl.c
@@ -39,6 +39,9 @@
char vt_dont_switch;
extern struct tty_driver *console_driver;
+/* Add a notifier chain to inform drivers of a VT_TEXT/VT_GRAPHICS switch */
+RAW_NOTIFIER_HEAD(console_notifier_list);
+
#define VT_IS_IN_USE(i) (console_driver->ttys[i] && console_driver->ttys[i]->count)
#define VT_BUSY(i) (VT_IS_IN_USE(i) || i == fg_console || vc_cons[i].d == sel_cons)
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index 2f11134..f257b3b 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -116,4 +116,23 @@ struct vt_spawn_console {
};
extern struct vt_spawn_console vt_spawn_con;
+/* A notifier list for console events */
+extern struct raw_notifier_head console_notifier_list;
+
+/* Called when the FG console switches to KD_TEXT mode */
+#define CONSOLE_EVENT_SWITCH_TEXT 0x01
+
+/* Called when the FG console switches to KD_GRAPHICS mode */
+#define CONSOLE_EVENT_SWITCH_GRAPHICS 0x02
+
+static inline int console_event_register(struct notifier_block *n)
+{
+ return raw_notifier_chain_register(&console_notifier_list, n);
+}
+
+static inline int console_event_unregister(struct notifier_block *n)
+{
+ return raw_notifier_chain_unregister(&console_notifier_list, n);
+}
+
#endif /* _VT_KERN_H */
--
1.6.3.3
More information about the devel
mailing list