mirror of
https://github.com/torvalds/linux.git
synced 2026-11-25 16:02:57 +00:00
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]>
44 lines
988 B
C
44 lines
988 B
C
/*
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
* for more details.
|
|
*
|
|
* Copyright (C) 2002, 2003, 06, 07 Ralf Baechle ([email protected])
|
|
* Copyright (C) 2007 MIPS Technologies, Inc.
|
|
* written by Ralf Baechle ([email protected])
|
|
*/
|
|
#include <linux/kernel.h>
|
|
#include <linux/console.h>
|
|
#include <linux/printk.h>
|
|
#include <linux/init.h>
|
|
|
|
#include <asm/setup.h>
|
|
|
|
extern void prom_putchar(char);
|
|
|
|
static void early_console_write(struct console *con, const char *s, unsigned n)
|
|
{
|
|
while (n-- && *s) {
|
|
if (*s == '\n')
|
|
prom_putchar('\r');
|
|
prom_putchar(*s);
|
|
s++;
|
|
}
|
|
}
|
|
|
|
static struct console early_console_prom = {
|
|
.name = "early",
|
|
.write = early_console_write,
|
|
.flags = CON_PRINTBUFFER | CON_BOOT,
|
|
.index = -1
|
|
};
|
|
|
|
void __init setup_early_printk(void)
|
|
{
|
|
if (early_console)
|
|
return;
|
|
early_console = &early_console_prom;
|
|
|
|
register_console(&early_console_prom);
|
|
}
|