Commit 8a09cec25fa19a3a7e9f21b4186fecc69085a60f
1 parent
c6188d0f57
Exists in
master
and in
16 other branches
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>
Showing 2 changed files with 18 additions and 6 deletions Side-by-side Diff
arch/m68k/amiga/config.c
... | ... | @@ -620,6 +620,8 @@ |
620 | 620 | |
621 | 621 | static int __init amiga_savekmsg_setup(char *arg) |
622 | 622 | { |
623 | + bool registered; | |
624 | + | |
623 | 625 | if (!MACH_IS_AMIGA || strcmp(arg, "mem")) |
624 | 626 | return 0; |
625 | 627 | |
626 | 628 | |
... | ... | @@ -636,8 +638,10 @@ |
636 | 638 | savekmsg->magicptr = ZTWO_PADDR(savekmsg); |
637 | 639 | savekmsg->size = 0; |
638 | 640 | |
641 | + registered = !!amiga_console_driver.write; | |
639 | 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 | 645 | return 0; |
642 | 646 | } |
643 | 647 | |
644 | 648 | |
... | ... | @@ -719,11 +723,16 @@ |
719 | 723 | |
720 | 724 | static int __init amiga_debug_setup(char *arg) |
721 | 725 | { |
722 | - if (MACH_IS_AMIGA && !strcmp(arg, "ser")) { | |
723 | - /* no initialization required (?) */ | |
724 | - amiga_console_driver.write = amiga_serial_console_write; | |
726 | + bool registered; | |
727 | + | |
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 | 735 | register_console(&amiga_console_driver); |
726 | - } | |
727 | 736 | return 0; |
728 | 737 | } |
729 | 738 |
arch/m68k/atari/debug.c
... | ... | @@ -287,6 +287,8 @@ |
287 | 287 | |
288 | 288 | static int __init atari_debug_setup(char *arg) |
289 | 289 | { |
290 | + bool registered; | |
291 | + | |
290 | 292 | if (!MACH_IS_ATARI) |
291 | 293 | return 0; |
292 | 294 | |
... | ... | @@ -294,6 +296,7 @@ |
294 | 296 | /* defaults to ser2 for a Falcon and ser1 otherwise */ |
295 | 297 | arg = MACH_IS_FALCON ? "ser2" : "ser1"; |
296 | 298 | |
299 | + registered = !!atari_console_driver.write; | |
297 | 300 | if (!strcmp(arg, "ser1")) { |
298 | 301 | /* ST-MFP Modem1 serial port */ |
299 | 302 | atari_init_mfp_port(B9600|CS8); |
... | ... | @@ -317,7 +320,7 @@ |
317 | 320 | sound_ym.wd_data = sound_ym.rd_data_reg_sel | 0x20; /* strobe H */ |
318 | 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 | 324 | register_console(&atari_console_driver); |
322 | 325 | |
323 | 326 | return 0; |