diff options
author | Robin Getz <rgetz@blackfin.uclinux.org> | 2009-07-09 13:08:37 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-07-10 06:24:47 -0400 |
commit | 8259cf4342029aad37660e524178c8858f48b0ab (patch) | |
tree | c0f7f931c6daca79a941dcab142cf49059a8722f /kernel/printk.c | |
parent | 4d09161196c9a836eacea4b36e2f217bc34894cf (diff) |
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 <rgetz@blackfin.uclinux.org>
Cc: "Andrew Morton" <akpm@linux-foundation.org>
Cc: "Linus Torvalds" <torvalds@linux-foundation.org>
LKML-Reference: <200907091308.37370.rgetz@blackfin.uclinux.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/printk.c')
-rw-r--r-- | kernel/printk.c | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/kernel/printk.c b/kernel/printk.c index 41fe60995530..668df351e6a9 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
@@ -1240,22 +1240,14 @@ void register_console(struct console *newcon) | |||
1240 | if (!(newcon->flags & CON_ENABLED)) | 1240 | if (!(newcon->flags & CON_ENABLED)) |
1241 | return; | 1241 | return; |
1242 | 1242 | ||
1243 | if (bcon && ((newcon->flags & (CON_CONSDEV | CON_BOOT)) == CON_CONSDEV)) { | 1243 | /* |
1244 | /* we need to iterate through twice, to make sure we print | 1244 | * If we have a bootconsole, and are switching to a real console, |
1245 | * everything out, before we unregister the console(s) | 1245 | * don't print everything out again, since when the boot console, and |
1246 | */ | 1246 | * the real console are the same physical device, it's annoying to |
1247 | printk(KERN_INFO "console handover:"); | 1247 | * see the beginning boot messages twice |
1248 | for_each_console(bcon) | 1248 | */ |
1249 | printk("boot [%s%d] ", bcon->name, bcon->index); | 1249 | if (bcon && ((newcon->flags & (CON_CONSDEV | CON_BOOT)) == CON_CONSDEV)) |
1250 | printk(" -> real [%s%d]\n", newcon->name, newcon->index); | ||
1251 | for_each_console(bcon) | ||
1252 | unregister_console(bcon); | ||
1253 | newcon->flags &= ~CON_PRINTBUFFER; | 1250 | newcon->flags &= ~CON_PRINTBUFFER; |
1254 | } else { | ||
1255 | printk(KERN_INFO "%sconsole [%s%d] enabled\n", | ||
1256 | (newcon->flags & CON_BOOT) ? "boot" : "" , | ||
1257 | newcon->name, newcon->index); | ||
1258 | } | ||
1259 | 1251 | ||
1260 | /* | 1252 | /* |
1261 | * Put this console in the list - keep the | 1253 | * Put this console in the list - keep the |
@@ -1281,6 +1273,28 @@ void register_console(struct console *newcon) | |||
1281 | spin_unlock_irqrestore(&logbuf_lock, flags); | 1273 | spin_unlock_irqrestore(&logbuf_lock, flags); |
1282 | } | 1274 | } |
1283 | release_console_sem(); | 1275 | release_console_sem(); |
1276 | |||
1277 | /* | ||
1278 | * By unregistering the bootconsoles after we enable the real console | ||
1279 | * we get the "console xxx enabled" message on all the consoles - | ||
1280 | * boot consoles, real consoles, etc - this is to ensure that end | ||
1281 | * users know there might be something in the kernel's log buffer that | ||
1282 | * went to the bootconsole (that they do not see on the real console) | ||
1283 | */ | ||
1284 | if (bcon && ((newcon->flags & (CON_CONSDEV | CON_BOOT)) == CON_CONSDEV)) { | ||
1285 | /* we need to iterate through twice, to make sure we print | ||
1286 | * everything out, before we unregister the console(s) | ||
1287 | */ | ||
1288 | printk(KERN_INFO "console [%s%d] enabled, bootconsole disabled\n", | ||
1289 | newcon->name, newcon->index); | ||
1290 | for_each_console(bcon) | ||
1291 | if (bcon->flags & CON_BOOT) | ||
1292 | unregister_console(bcon); | ||
1293 | } else { | ||
1294 | printk(KERN_INFO "%sconsole [%s%d] enabled\n", | ||
1295 | (newcon->flags & CON_BOOT) ? "boot" : "" , | ||
1296 | newcon->name, newcon->index); | ||
1297 | } | ||
1284 | } | 1298 | } |
1285 | EXPORT_SYMBOL(register_console); | 1299 | EXPORT_SYMBOL(register_console); |
1286 | 1300 | ||