Title: [7151] trunk/kernel/printk.c: Fix [#5420] Commit patch that was sent upstream (already included in
Revision
7151
Author
rgetz
Date
2009-08-11 08:41:04 -0400 (Tue, 11 Aug 2009)

Log Message

Fix [#5420] Commit patch that was sent upstream (already included in
-tip), and missed in our svn.

Author: Robin Getz <[email protected]>
Date:   Thu Jul 9 13:08:37 2009 -0400

    printk: Ensure that "console enabled" messages are printed on the console

    Today, when a console is registered without CON_PRINTBUFFER,
    end users never see the announcement of it being added, and
    never know if they missed something, if the console is really
    at the start or not, and just leads to general confusion.

    This re-orders existing code, to make sure the console is
    added, before the "console [%s%d] enabled" is printed out -
    ensuring that this message is _always_ seen.

    This has the desired/intended side effect of making sure that
    "console enabled:" messages are printed on the bootconsole, and
    the real console. This does cause the same line is printed
    twice if the bootconsole and real console are the same device,
    but if they are on different devices, the message is printed to
    both consoles.

    Signed-off-by : Robin Getz <[email protected]>
    Cc: "Andrew Morton" <[email protected]>
    Cc: "Linus Torvalds" <[email protected]>
    LKML-Reference: <[email protected]>
    Signed-off-by: Ingo Molnar <[email protected]>

Modified Paths

Diff

Modified: trunk/kernel/printk.c (7150 => 7151)


--- trunk/kernel/printk.c	2009-08-11 04:26:28 UTC (rev 7150)
+++ trunk/kernel/printk.c	2009-08-11 12:41:04 UTC (rev 7151)
@@ -1225,23 +1225,6 @@
 	if (!(newcon->flags & CON_ENABLED))
 		return;
 
-	if (bcon && ((newcon->flags & (CON_CONSDEV | CON_BOOT)) == CON_CONSDEV)) {
-		/* we need to iterate through twice, to make sure we print
-		 * everything out, before we unregister the console(s)
-		 */
-		printk(KERN_INFO "console handover:");
-		for_each_console(bcon)
-			printk("boot [%s%d] ", bcon->name, bcon->index);
-		printk(" -> real [%s%d]\n", newcon->name, newcon->index);
-		for_each_console(bcon)
-			unregister_console(bcon);
-		newcon->flags &= ~CON_PRINTBUFFER;
-	} else {
-		printk(KERN_INFO "%sconsole [%s%d] enabled\n",
-			(newcon->flags & CON_BOOT) ? "boot" : "" ,
-			newcon->name, newcon->index);
-	}
-
 	/*
 	 *	Put this console in the list - keep the
 	 *	preferred driver at the head of the list.
@@ -1266,6 +1249,30 @@
 		spin_unlock_irqrestore(&logbuf_lock, flags);
 	}
 	release_console_sem();
+
+	/*
+	 * By unregistering the bootconsoles after we enable the real console
+	 * we get the "console xxx enabled" message on all the consoles -
+	 * boot consoles, real consoles, etc - this is to ensure that end
+	 * users know there might be something in the kernel's log buffer that
+	 * went to the bootconsole (that they do not see on the real console)
+	 */
+	if (bcon && ((newcon->flags & (CON_CONSDEV | CON_BOOT)) == CON_CONSDEV)) {
+		/* we need to iterate through twice, to make sure we print
+		 * everything out, before we unregister the console(s)
+		 */
+		printk(KERN_INFO "console [%s%d] enabled, bootconsole disabled\n",
+			newcon->name, newcon->index);
+		for_each_console(bcon)
+			if (bcon->flags & CON_BOOT)
+				unregister_console(bcon);
+		newcon->flags &= ~CON_PRINTBUFFER;
+	} else {
+		printk(KERN_INFO "%sconsole [%s%d] enabled\n",
+			(newcon->flags & CON_BOOT) ? "boot" : "" ,
+			newcon->name, newcon->index);
+	}
+
 }
 EXPORT_SYMBOL(register_console);
 
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to