mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
early_printk: consolidate random copies of identical code
The early console implementations are the same all over the place. Move the print function to kernel/printk and get rid of the copies. [[email protected]: arch/mips/kernel/early_printk.c needs kernel.h for va_list] [[email protected]: sh4: make the bios early console support depend on EARLY_PRINTK] Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Paul Gortmaker <[email protected]> Cc: Russell King <[email protected]> Acked-by: Mike Frysinger <[email protected]> Cc: Michal Simek <[email protected]> Cc: Ralf Baechle <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Paul Mundt <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Chris Metcalf <[email protected]> Cc: Richard Weinberger <[email protected]> Reviewed-by: Ingo Molnar <[email protected]> Tested-by: Paul Gortmaker <[email protected]> Cc: Geert Uytterhoeven <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
07c65f4d1a
commit
d0380e6c3c
13 changed files with 63 additions and 109 deletions
|
|
@ -17,6 +17,7 @@
|
|||
#include <linux/init.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/irqflags.h>
|
||||
#include <linux/printk.h>
|
||||
#include <asm/setup.h>
|
||||
#include <hv/hypervisor.h>
|
||||
|
||||
|
|
@ -33,25 +34,8 @@ static struct console early_hv_console = {
|
|||
};
|
||||
|
||||
/* Direct interface for emergencies */
|
||||
static struct console *early_console = &early_hv_console;
|
||||
static int early_console_initialized;
|
||||
static int early_console_complete;
|
||||
|
||||
static void early_vprintk(const char *fmt, va_list ap)
|
||||
{
|
||||
char buf[512];
|
||||
int n = vscnprintf(buf, sizeof(buf), fmt, ap);
|
||||
early_console->write(early_console, buf, n);
|
||||
}
|
||||
|
||||
void early_printk(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
early_vprintk(fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void early_panic(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
|
@ -69,14 +53,13 @@ static int __initdata keep_early;
|
|||
|
||||
static int __init setup_early_printk(char *str)
|
||||
{
|
||||
if (early_console_initialized)
|
||||
if (early_console)
|
||||
return 1;
|
||||
|
||||
if (str != NULL && strncmp(str, "keep", 4) == 0)
|
||||
keep_early = 1;
|
||||
|
||||
early_console = &early_hv_console;
|
||||
early_console_initialized = 1;
|
||||
register_console(early_console);
|
||||
|
||||
return 0;
|
||||
|
|
@ -85,12 +68,12 @@ static int __init setup_early_printk(char *str)
|
|||
void __init disable_early_printk(void)
|
||||
{
|
||||
early_console_complete = 1;
|
||||
if (!early_console_initialized || !early_console)
|
||||
if (!early_console)
|
||||
return;
|
||||
if (!keep_early) {
|
||||
early_printk("disabling early console\n");
|
||||
unregister_console(early_console);
|
||||
early_console_initialized = 0;
|
||||
early_console = NULL;
|
||||
} else {
|
||||
early_printk("keeping early console\n");
|
||||
}
|
||||
|
|
@ -98,7 +81,7 @@ void __init disable_early_printk(void)
|
|||
|
||||
void warn_early_printk(void)
|
||||
{
|
||||
if (early_console_complete || early_console_initialized)
|
||||
if (early_console_complete || early_console)
|
||||
return;
|
||||
early_printk("\
|
||||
Machine shutting down before console output is fully initialized.\n\
|
||||
|
|
|
|||
Loading…
Reference in a new issue