diff options
author | Russell King <rmk@arm.linux.org.uk> | 2004-06-29 05:16:30 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-06-29 05:16:30 -0700 |
commit | d070a4344d28190dbdfeaebc416681a569e2cded (patch) | |
tree | 34acd1d884b198f949dcd32a96f7fd6667e990c2 /kernel | |
parent | f8bd2a5f6a89fa37b3e896b938b5bda5c643eacb (diff) | |
download | history-d070a4344d28190dbdfeaebc416681a569e2cded.tar.gz |
[PATCH] Provide console_device()
[This patch series has also been separately sent to the architecture
maintainers]
Add console_device() to return the console tty driver structure and the
index. Acquire the console lock while scanning the list of console drivers
to protect us against console driver list manipulations.
Signed-off-by: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/printk.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/kernel/printk.c b/kernel/printk.c index 9e34ce41beb6de..224c37c0e28db8 100644 --- a/kernel/printk.c +++ b/kernel/printk.c @@ -684,6 +684,26 @@ void console_unblank(void) EXPORT_SYMBOL(console_unblank); /* + * Return the console tty driver structure and its associated index + */ +struct tty_driver *console_device(int *index) +{ + struct console *c; + struct tty_driver *driver = NULL; + + acquire_console_sem(); + for (c = console_drivers; c != NULL; c = c->next) { + if (!c->device) + continue; + driver = c->device(c, index); + if (driver) + break; + } + release_console_sem(); + return driver; +} + +/* * The console driver calls this routine during kernel initialization * to register the console printing procedure with printk() and to * print any messages that were printed by the kernel before the |