aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68k
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert@linux-m68k.org>2013-12-01 05:14:51 -0500
committerGeert Uytterhoeven <geert@linux-m68k.org>2013-12-08 05:03:21 -0500
commit8a09cec25fa19a3a7e9f21b4186fecc69085a60f (patch)
tree09099f3d883d9e8736e8ba363ffc79560038a976 /arch/m68k
parentc6188d0f5756e3b20c216483cc7982d097c7b9de (diff)
m68k/amiga,atari: Fix specifying multiple debug= parameters
Since commit d6713b4091a99fa2af2fabdcd2f3fb97f32ecf2e ("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: Geert Uytterhoeven <geert@linux-m68k.org>
Diffstat (limited to 'arch/m68k')
-rw-r--r--arch/m68k/amiga/config.c19
-rw-r--r--arch/m68k/atari/debug.c5
2 files changed, 18 insertions, 6 deletions
diff --git a/arch/m68k/amiga/config.c b/arch/m68k/amiga/config.c
index c425fa6c2795..9625b7132227 100644
--- a/arch/m68k/amiga/config.c
+++ b/arch/m68k/amiga/config.c
@@ -620,6 +620,8 @@ static void amiga_mem_console_write(struct console *co, const char *s,
620 620
621static int __init amiga_savekmsg_setup(char *arg) 621static int __init amiga_savekmsg_setup(char *arg)
622{ 622{
623 bool registered;
624
623 if (!MACH_IS_AMIGA || strcmp(arg, "mem")) 625 if (!MACH_IS_AMIGA || strcmp(arg, "mem"))
624 return 0; 626 return 0;
625 627
@@ -636,8 +638,10 @@ static int __init amiga_savekmsg_setup(char *arg)
636 savekmsg->magicptr = ZTWO_PADDR(savekmsg); 638 savekmsg->magicptr = ZTWO_PADDR(savekmsg);
637 savekmsg->size = 0; 639 savekmsg->size = 0;
638 640
641 registered = !!amiga_console_driver.write;
639 amiga_console_driver.write = amiga_mem_console_write; 642 amiga_console_driver.write = amiga_mem_console_write;
640 register_console(&amiga_console_driver); 643 if (!registered)
644 register_console(&amiga_console_driver);
641 return 0; 645 return 0;
642} 646}
643 647
@@ -719,11 +723,16 @@ void amiga_serial_gets(struct console *co, char *s, int len)
719 723
720static int __init amiga_debug_setup(char *arg) 724static int __init amiga_debug_setup(char *arg)
721{ 725{
722 if (MACH_IS_AMIGA && !strcmp(arg, "ser")) { 726 bool registered;
723 /* no initialization required (?) */ 727
724 amiga_console_driver.write = amiga_serial_console_write; 728 if (!MACH_IS_AMIGA || strcmp(arg, "ser"))
729 return 0;
730
731 /* no initialization required (?) */
732 registered = !!amiga_console_driver.write;
733 amiga_console_driver.write = amiga_serial_console_write;
734 if (!registered)
725 register_console(&amiga_console_driver); 735 register_console(&amiga_console_driver);
726 }
727 return 0; 736 return 0;
728} 737}
729 738
diff --git a/arch/m68k/atari/debug.c b/arch/m68k/atari/debug.c
index a547ba9683d1..03cb5e08d7cf 100644
--- a/arch/m68k/atari/debug.c
+++ b/arch/m68k/atari/debug.c
@@ -287,6 +287,8 @@ static void __init atari_init_midi_port(int cflag)
287 287
288static int __init atari_debug_setup(char *arg) 288static int __init atari_debug_setup(char *arg)
289{ 289{
290 bool registered;
291
290 if (!MACH_IS_ATARI) 292 if (!MACH_IS_ATARI)
291 return 0; 293 return 0;
292 294
@@ -294,6 +296,7 @@ static int __init atari_debug_setup(char *arg)
294 /* defaults to ser2 for a Falcon and ser1 otherwise */ 296 /* defaults to ser2 for a Falcon and ser1 otherwise */
295 arg = MACH_IS_FALCON ? "ser2" : "ser1"; 297 arg = MACH_IS_FALCON ? "ser2" : "ser1";
296 298
299 registered = !!atari_console_driver.write;
297 if (!strcmp(arg, "ser1")) { 300 if (!strcmp(arg, "ser1")) {
298 /* ST-MFP Modem1 serial port */ 301 /* ST-MFP Modem1 serial port */
299 atari_init_mfp_port(B9600|CS8); 302 atari_init_mfp_port(B9600|CS8);
@@ -317,7 +320,7 @@ static int __init atari_debug_setup(char *arg)
317 sound_ym.wd_data = sound_ym.rd_data_reg_sel | 0x20; /* strobe H */ 320 sound_ym.wd_data = sound_ym.rd_data_reg_sel | 0x20; /* strobe H */
318 atari_console_driver.write = atari_par_console_write; 321 atari_console_driver.write = atari_par_console_write;
319 } 322 }
320 if (atari_console_driver.write) 323 if (atari_console_driver.write && !registered)
321 register_console(&atari_console_driver); 324 register_console(&atari_console_driver);
322 325
323 return 0; 326 return 0;