ChangeSet 1.2231.1.148, 2005/03/28 19:57:38-08:00, [EMAIL PROTECTED]
[PATCH] New console flag: CON_BOOT
CON_BOOT is like early printk in that it allows for output really early
on.
It's better than early printk because it unregisters automatically
when a
real console is initialised. So if you don't get consoles registering
in
console_init, there isn't a huge delay between the boot console
unregistering and the real console starting. This is the case on
PA-RISC
where we have serial ports that aren't discovered until the PCI bus has
been walked.
I think all the current early printk users could be converted to this
scheme with a minimal amount of effort.
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
include/linux/console.h | 8 ++++++--
kernel/printk.c | 5 +++++
2 files changed, 11 insertions(+), 2 deletions(-)
diff -Nru a/include/linux/console.h b/include/linux/console.h
--- a/include/linux/console.h 2005-03-28 21:39:02 -08:00
+++ b/include/linux/console.h 2005-03-28 21:39:02 -08:00
@@ -77,13 +77,17 @@
#define CM_MOVE (3)
/*
- * The interface for a console, or any other device that
- * wants to capture console messages (printer driver?)
+ * The interface for a console, or any other device that wants to capture
+ * console messages (printer driver?)
+ *
+ * If a console driver is marked CON_BOOT then it will be auto-unregistered
+ * when the first real console is registered. This is for early-printk
drivers.
*/
#define CON_PRINTBUFFER (1)
#define CON_CONSDEV (2) /* Last on the command line */
#define CON_ENABLED (4)
+#define CON_BOOT (8)
struct console
{
diff -Nru a/kernel/printk.c b/kernel/printk.c
--- a/kernel/printk.c 2005-03-28 21:39:02 -08:00
+++ b/kernel/printk.c 2005-03-28 21:39:02 -08:00
@@ -861,6 +861,11 @@
if (!(console->flags & CON_ENABLED))
return;
+ if (console_drivers && (console_drivers->flags & CON_BOOT)) {
+ unregister_console(console_drivers);
+ console->flags &= ~CON_PRINTBUFFER;
+ }
+
/*
* Put this console in the list - keep the
* preferred driver at the head of the list.
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html