* [PATCH 3/7 v6] initdev:kernel:Await console discovery
@ 2009-08-04 22:15 David VomLehn
0 siblings, 0 replies; only message in thread
From: David VomLehn @ 2009-08-04 22:15 UTC (permalink / raw)
To: linux-kernel; +Cc: akpm, linux-usb, greg, linux-scsi, netdev, arjan
Wait for the console device to become available or for it to be determined
that no console is attached a boot time.
Signed-off-by: David VomLehn <dvomlehn@cisco.com>
---
drivers/accessibility/braille/braille_console.c | 2 +
kernel/printk.c | 29 ++++++++++++++++++++++-
2 files changed, 30 insertions(+), 1 deletions(-)
diff --git a/drivers/accessibility/braille/braille_console.c b/drivers/accessibility/braille/braille_console.c
index d672cfe..6d1693f 100644
--- a/drivers/accessibility/braille/braille_console.c
+++ b/drivers/accessibility/braille/braille_console.c
@@ -378,6 +378,8 @@ int braille_register_console(struct console *console, int index,
braille_co = console;
register_keyboard_notifier(&keyboard_notifier_block);
register_vt_notifier(&vt_notifier_block);
+
+ initdev_registered(INITDEV_CONSOLE_TYPE);
return 0;
}
diff --git a/kernel/printk.c b/kernel/printk.c
index 5052b54..7cdc91c 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -33,6 +33,7 @@
#include <linux/bootmem.h>
#include <linux/syscalls.h>
#include <linux/kexec.h>
+#include <linux/device.h>
#include <asm/uaccess.h>
@@ -1075,8 +1076,10 @@ void console_unblank(void)
/*
* Return the console tty driver structure and its associated index
+ * @index: Pointer to the device index
+ * Returns NULL if no driver available, otherwise a pointer to the TTY driver.
*/
-struct tty_driver *console_device(int *index)
+struct tty_driver *_console_device(int *index)
{
struct console *c;
struct tty_driver *driver = NULL;
@@ -1094,6 +1097,29 @@ struct tty_driver *console_device(int *index)
}
/*
+ * Returns true if all specific consoles are registered, false otherwise
+ */
+static bool have_all_consoles(void)
+{
+ struct tty_driver *driver;
+ int index;
+
+ driver = _console_device(&index);
+
+ return driver != NULL;
+}
+
+struct tty_driver *console_device(int *index)
+{
+ struct tty_driver *driver;
+ initdev_wait(INITDEV_CONSOLE_TYPE, have_all_consoles);
+
+ driver = _console_device(index);
+
+ return driver;
+}
+
+/*
* Prevent further output on the passed console device so that (for example)
* serial drivers can disable console output before suspending a port, and can
* re-enable output afterwards.
@@ -1230,6 +1256,7 @@ void register_console(struct console *console)
spin_unlock_irqrestore(&logbuf_lock, flags);
}
release_console_sem();
+ initdev_registered(INITDEV_CONSOLE_TYPE);
}
EXPORT_SYMBOL(register_console);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-08-04 22:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-04 22:15 [PATCH 3/7 v6] initdev:kernel:Await console discovery David VomLehn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®