Commit 8a09cec2 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven

m68k/amiga,atari: Fix specifying multiple debug= parameters

Since commit d6713b40 ("m68k: early
parameter support"), the user can specify multiple debug consoles using the
"debug=" kernel command line parameter.
However, as there's only a single struct console object, which is reused,
it would actually register the same console object multiple times, causing
the following warning:

WARNING: CPU: 0 PID: 0 at kernel/printk/printk.c:2233 register_console+0x36/
console 'debug0' already registered

Make sure to register the console object only once, to avoid the warning.

Note that still only one console (the one corresponding to the last
"debug=" parameter) will be active at the same time, as the .write() method
of the already registered console object is overwritten by a subsequent
"debug=" parameter.
Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
parent c6188d0f
...@@ -620,6 +620,8 @@ static void amiga_mem_console_write(struct console *co, const char *s, ...@@ -620,6 +620,8 @@ static void amiga_mem_console_write(struct console *co, const char *s,
static int __init amiga_savekmsg_setup(char *arg) static int __init amiga_savekmsg_setup(char *arg)
{ {
bool registered;
if (!MACH_IS_AMIGA || strcmp(arg, "mem")) if (!MACH_IS_AMIGA || strcmp(arg, "mem"))
return 0; return 0;
...@@ -636,8 +638,10 @@ static int __init amiga_savekmsg_setup(char *arg) ...@@ -636,8 +638,10 @@ static int __init amiga_savekmsg_setup(char *arg)
savekmsg->magicptr = ZTWO_PADDR(savekmsg); savekmsg->magicptr = ZTWO_PADDR(savekmsg);
savekmsg->size = 0; savekmsg->size = 0;
registered = !!amiga_console_driver.write;
amiga_console_driver.write = amiga_mem_console_write; amiga_console_driver.write = amiga_mem_console_write;
register_console(&amiga_console_driver); if (!registered)
register_console(&amiga_console_driver);
return 0; return 0;
} }
...@@ -719,11 +723,16 @@ void amiga_serial_gets(struct console *co, char *s, int len) ...@@ -719,11 +723,16 @@ void amiga_serial_gets(struct console *co, char *s, int len)
static int __init amiga_debug_setup(char *arg) static int __init amiga_debug_setup(char *arg)
{ {
if (MACH_IS_AMIGA && !strcmp(arg, "ser")) { bool registered;
/* no initialization required (?) */
amiga_console_driver.write = amiga_serial_console_write; if (!MACH_IS_AMIGA || strcmp(arg, "ser"))
return 0;
/* no initialization required (?) */
registered = !!amiga_console_driver.write;
amiga_console_driver.write = amiga_serial_console_write;
if (!registered)
register_console(&amiga_console_driver); register_console(&amiga_console_driver);
}
return 0; return 0;
} }
......
...@@ -287,6 +287,8 @@ static void __init atari_init_midi_port(int cflag) ...@@ -287,6 +287,8 @@ static void __init atari_init_midi_port(int cflag)
static int __init atari_debug_setup(char *arg) static int __init atari_debug_setup(char *arg)
{ {
bool registered;
if (!MACH_IS_ATARI) if (!MACH_IS_ATARI)
return 0; return 0;
...@@ -294,6 +296,7 @@ static int __init atari_debug_setup(char *arg) ...@@ -294,6 +296,7 @@ static int __init atari_debug_setup(char *arg)
/* defaults to ser2 for a Falcon and ser1 otherwise */ /* defaults to ser2 for a Falcon and ser1 otherwise */
arg = MACH_IS_FALCON ? "ser2" : "ser1"; arg = MACH_IS_FALCON ? "ser2" : "ser1";
registered = !!atari_console_driver.write;
if (!strcmp(arg, "ser1")) { if (!strcmp(arg, "ser1")) {
/* ST-MFP Modem1 serial port */ /* ST-MFP Modem1 serial port */
atari_init_mfp_port(B9600|CS8); atari_init_mfp_port(B9600|CS8);
...@@ -317,7 +320,7 @@ static int __init atari_debug_setup(char *arg) ...@@ -317,7 +320,7 @@ static int __init atari_debug_setup(char *arg)
sound_ym.wd_data = sound_ym.rd_data_reg_sel | 0x20; /* strobe H */ sound_ym.wd_data = sound_ym.rd_data_reg_sel | 0x20; /* strobe H */
atari_console_driver.write = atari_par_console_write; atari_console_driver.write = atari_par_console_write;
} }
if (atari_console_driver.write) if (atari_console_driver.write && !registered)
register_console(&atari_console_driver); register_console(&atari_console_driver);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment