Skip to contentSkip to conversation

use CON_BOOT in early printk code

PATCH New Jan Beulich 1 participant 1 message Nov 15, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 use CON_BOOT in early printk code

Making the code simpler and closing the time window between disabling the early console and getting the real one ready.

Once all architectures using CONFIG_EARLY_PRINTK have done so, the dummy disable_early_printk() could then also be removed.

arch/x86_64/kernel/early_printk.c +8 -17
@@ -56,7 +56,7 @@ static void early_vga_write(struct conso
 static struct console early_vga_console = {
 	.name =		"earlyvga",
 	.write =	early_vga_write,
-	.flags =	CON_PRINTBUFFER,
+	.flags =	CON_PRINTBUFFER | CON_BOOT,
 	.index =	-1,
 };
 
@@ -152,7 +152,7 @@ static __init void early_serial_init(cha
 static struct console early_serial_console = {
 	.name =		"earlyser",
 	.write =	early_serial_write,
-	.flags =	CON_PRINTBUFFER,
+	.flags =	CON_PRINTBUFFER | CON_BOOT,
 	.index =	-1,
 };
 
@@ -213,8 +213,6 @@ void early_printk(const char *fmt, ...)
 	va_end(ap);
 }
 
-static int __initdata keep_early;
-
 static int __init setup_early_printk(char *buf)
 {
 	if (!buf)
@@ -224,9 +222,6 @@ static int __init setup_early_printk(cha
 		return 0;
 	early_console_initialized = 1;
 
-	if (!strcmp(buf,"keep"))
-		keep_early = 1;
-
 	if (!strncmp(buf, "serial", 6)) {
 		early_serial_init(buf + 6);
 		early_console = &early_serial_console;
@@ -242,9 +237,14 @@ static int __init setup_early_printk(cha
  	} else if (!strncmp(buf, "simnow", 6)) {
  		simnow_init(buf + 6);
  		early_console = &simnow_console;
- 		keep_early = 1;
 	}
+	if (strstr(buf,"keep"))
+		early_console->flags &= ~CON_BOOT;
+
 	register_console(early_console);
+	if (!(early_console->flags & CON_BOOT))
+		printk("Will keep early console.\n");
+
 	return 0;
 }
 
@@ -252,14 +252,5 @@ early_param("earlyprintk", setup_early_p
 
 void __init disable_early_printk(void)
 {
-	if (!early_console_initialized || !early_console)
-		return;
-	if (!keep_early) {
-		printk("disabling early console\n");
-		unregister_console(early_console);
-		early_console_initialized = 0;
-	} else {
-		printk("keeping early console\n");
-	}
 }