Skip to contentSkip to conversation

m68k/setup: Use pr_*() instead of plain printk()

PATCH Superseded Geert Uytterhoeven 2 participants 4 messages Jun 30, 2013 – Jul 1, 2013 m68k architecture

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Geert Uytterhoeven

author maintainer
#0 lore raw

PATCH 1/1 m68k/setup: Use pr_*() instead of plain printk()

---
 arch/m68k/kernel/setup_mm.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
arch/m68k/kernel/setup_mm.c +9 -9
index e67e531..a2c2c0c 100644
@@ -161,7 +161,7 @@ static void __init m68k_parse_bootinfo(const struct bi_record *record)
 				m68k_memory[m68k_num_memory].size = data[1];
 				m68k_num_memory++;
 			} else
-				printk("m68k_parse_bootinfo: too many memory chunks\n");
+				pr_warn("m68k_parse_bootinfo: too many memory chunks\n");
 			break;
 
 		case BI_RAMDISK:
@@ -197,8 +197,8 @@ static void __init m68k_parse_bootinfo(const struct bi_record *record)
 				unknown = 1;
 		}
 		if (unknown)
-			printk("m68k_parse_bootinfo: unknown tag 0x%04x ignored\n",
-			       record->tag);
+			pr_warn("m68k_parse_bootinfo: unknown tag 0x%04x ignored\n",
+				   record->tag);
 		record = (struct bi_record *)((unsigned long)record +
 					      record->size);
 	}
@@ -206,8 +206,8 @@ static void __init m68k_parse_bootinfo(const struct bi_record *record)
 	m68k_realnum_memory = m68k_num_memory;
 #ifdef CONFIG_SINGLE_MEMORY_CHUNK
 	if (m68k_num_memory > 1) {
-		printk("Ignoring last %i chunks of physical memory\n",
-		       (m68k_num_memory - 1));
+		pr_warn("Ignoring last %i chunks of physical memory\n",
+			(m68k_num_memory - 1));
 		m68k_num_memory = 1;
 	}
 #endif
@@ -247,7 +247,7 @@ void __init setup_arch(char **cmdline_p)
 		asm (".chip 68060; movec %%pcr,%0; .chip 68k"
 		     : "=d" (pcr));
 		if (((pcr >> 8) & 0xff) <= 5) {
-			printk("Enabling workaround for errata I14\n");
+			pr_warn("Enabling workaround for errata I14\n");
 			asm (".chip 68060; movec %0,%%pcr; .chip 68k"
 			     : : "d" (pcr | 0x20));
 		}
@@ -353,7 +353,7 @@ void __init setup_arch(char **cmdline_p)
 				     BOOTMEM_DEFAULT);
 		initrd_start = (unsigned long)phys_to_virt(m68k_ramdisk.addr);
 		initrd_end = initrd_start + m68k_ramdisk.size;
-		printk("initrd: %08lx - %08lx\n", initrd_start, initrd_end);
+		pr_info("initrd: %08lx - %08lx\n", initrd_start, initrd_end);
 	}
 #endif
 
@@ -538,9 +538,9 @@ void check_bugs(void)
 {
 #ifndef CONFIG_M68KFPU_EMU
 	if (m68k_fputype == 0) {
-		printk(KERN_EMERG "*** YOU DO NOT HAVE A FLOATING POINT UNIT, "
+		pr_emerg("*** YOU DO NOT HAVE A FLOATING POINT UNIT, "
 			"WHICH IS REQUIRED BY LINUX/M68K ***\n");
-		printk(KERN_EMERG "Upgrade your hardware or join the FPU "
+		pr_emerg("Upgrade your hardware or join the FPU "
 			"emulation project\n");
 		panic("no FPU");
 	}
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 1 line · Geert Uytterhoeven

Hi Geert, just trivial comments...

arch/m68k/kernel/setup_mm.c static void __init m68k_parse_bootinfo(const struct bi_record *record)

Quoted 3 lines
arch/m68k/kernel/setup_mm.c +0 -0
@@ -161,7 +161,7 @@ static void __init m68k_parse_bootinfo(const struct bi_record *record)

[]

arch/m68k/kernel/setup_mm.c static void __init m68k_parse_bootinfo(const struct bi_record *record) · line 164

Quoted 2 lines
arch/m68k/kernel/setup_mm.c +1 -1
-				printk("m68k_parse_bootinfo: too many memory chunks\n");
+				pr_warn("m68k_parse_bootinfo: too many memory chunks\n");

These are generally better written by removing the hand-written function name and using "%s: ", __func__

				pr_warn("%s: too many memory chunks\n",
					__func__);

arch/m68k/kernel/setup_mm.c static void __init m68k_parse_bootinfo(const struct bi_record *record) · line 199

Quoted 6 lines
arch/m68k/kernel/setup_mm.c +2 -2
@@ -197,8 +197,8 @@ static void __init m68k_parse_bootinfo(const struct bi_record *record)
 
-			printk("m68k_parse_bootinfo: unknown tag 0x%04x ignored\n",
-			       record->tag);
+			pr_warn("m68k_parse_bootinfo: unknown tag 0x%04x ignored\n",
+				   record->tag);

etc.

arch/m68k/kernel/setup_mm.c void check_bugs(void) · line 544

Quoted 10 lines
arch/m68k/kernel/setup_mm.c +2 -2
@@ -538,9 +538,9 @@ void check_bugs(void)
 {
 #ifndef CONFIG_M68KFPU_EMU
 	if (m68k_fputype == 0) {
-		printk(KERN_EMERG "*** YOU DO NOT HAVE A FLOATING POINT UNIT, "
+		pr_emerg("*** YOU DO NOT HAVE A FLOATING POINT UNIT, "
 			"WHICH IS REQUIRED BY LINUX/M68K ***\n");
-		printk(KERN_EMERG "Upgrade your hardware or join the FPU "
+		pr_emerg("Upgrade your hardware or join the FPU "
 			"emulation project\n");

It would be nicer to coalesce the formats into a single line.

author maintainer
#2 lore raw
Quoted 7 lines · Joe Perches

arch/m68k/kernel/setup_mm.c static void __init m68k_parse_bootinfo(const struct bi_record *record)

Quoted 3 lines
arch/m68k/kernel/setup_mm.c +0 -0
@@ -161,7 +161,7 @@ static void __init m68k_parse_bootinfo(const struct bi_record *record)

[]

arch/m68k/kernel/setup_mm.c static void __init m68k_parse_bootinfo(const struct bi_record *record) · line 164

Quoted 2 lines
arch/m68k/kernel/setup_mm.c +1 -1
-                             printk("m68k_parse_bootinfo: too many memory chunks\n");
+                             pr_warn("m68k_parse_bootinfo: too many memory chunks\n");
Quoted 6 lines

These are generally better written by
removing the hand-written function name
and using "%s: ", __func__

pr_warn("%s: too many memory chunks\n",
__func__);

I had tried that, too. But surprisingly (although the same function name was in two
messages), it increased the size of the kernel image.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#3 lore raw
Quoted 12 lines · Geert Uytterhoeven
Quoted 11 lines · Joe Perches

arch/m68k/kernel/setup_mm.c static void __init m68k_parse_bootinfo(const struct bi_record *record)

Quoted 3 lines
arch/m68k/kernel/setup_mm.c +0 -0
@@ -161,7 +161,7 @@ static void __init m68k_parse_bootinfo(const struct bi_record *record)

[]

arch/m68k/kernel/setup_mm.c static void __init m68k_parse_bootinfo(const struct bi_record *record) · line 164

Quoted 2 lines
arch/m68k/kernel/setup_mm.c +1 -1
-                             printk("m68k_parse_bootinfo: too many memory chunks\n");
+                             pr_warn("m68k_parse_bootinfo: too many memory chunks\n");

These are generally better written by
removing the hand-written function name
and using "%s: ", __func__

Quoted 6 lines
Quoted 2 lines

pr_warn("%s: too many memory chunks\n",
__func__);

I had tried that, too. But surprisingly (although the same function name was in two
messages), it increased the size of the kernel image.

That's not surprising really.
There is more call frame stack per use too.

It does eliminate any issue with function renaming though and is also less typo prone.

And, at some point, those __func__ uses could be identified and rolled into a mechanism to emit the function name via a standardized use of %pf and __builtin_return_address(0) in the printk subsystem.

cheers, Joe