mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-08-26 01:02:46 +00:00

When MACH_IS_MVME147, the boot console calls mvme147_scc_write() to
generate console output. That will continue to work even after
debug_cons_nputs() becomes unavailable so there's no need to
unregister the boot console.
Take the opportunity to remove a repeated MACH_IS_* test. Use the
actual .write method (instead of a wrapper) and test that pointer
instead. This means adding an unused parameter to debug_cons_nputs() for
consistency with the struct console API.
early_printk.c is only built when CONFIG_EARLY_PRINTK=y. As of late,
head.S is only built when CONFIG_MMU_MOTOROLA=y. So let the former symbol
depend on the latter, to obviate some ifdef conditionals.
Cc: Daniel Palmer <daniel@0x0f.com>
Fixes: 077b33b9e2
("m68k: mvme147: Reinstate early console")
Signed-off-by: Finn Thain <fthain@linux-m68k.org>
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Link: https://lore.kernel.org/d1d4328e5aa9a87bd8352529ce62b767731c0530.1743467205.git.fthain@linux-m68k.org
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
57 lines
1.4 KiB
C
57 lines
1.4 KiB
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) 2014 Finn Thain
|
|
*/
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/console.h>
|
|
#include <linux/init.h>
|
|
#include <linux/string.h>
|
|
#include <asm/setup.h>
|
|
|
|
|
|
#include "../mvme147/mvme147.h"
|
|
#include "../mvme16x/mvme16x.h"
|
|
|
|
asmlinkage void __init debug_cons_nputs(struct console *c, const char *s, unsigned int n);
|
|
|
|
static struct console early_console_instance = {
|
|
.name = "debug",
|
|
.flags = CON_PRINTBUFFER | CON_BOOT,
|
|
.index = -1
|
|
};
|
|
|
|
static int __init setup_early_printk(char *buf)
|
|
{
|
|
if (early_console || buf)
|
|
return 0;
|
|
|
|
if (MACH_IS_MVME147)
|
|
early_console_instance.write = mvme147_scc_write;
|
|
else if (MACH_IS_MVME16x)
|
|
early_console_instance.write = mvme16x_cons_write;
|
|
else
|
|
early_console_instance.write = debug_cons_nputs;
|
|
early_console = &early_console_instance;
|
|
register_console(early_console);
|
|
|
|
return 0;
|
|
}
|
|
early_param("earlyprintk", setup_early_printk);
|
|
|
|
static int __init unregister_early_console(void)
|
|
{
|
|
/*
|
|
* debug_cons_nputs() defined in arch/m68k/kernel/head.S cannot be
|
|
* called after init sections are discarded (for platforms that use it).
|
|
*/
|
|
if (early_console && early_console->write == debug_cons_nputs)
|
|
return unregister_console(early_console);
|
|
|
|
return 0;
|
|
}
|
|
late_initcall(unregister_early_console);
|