MIPS: Add severity levels to printk statements during kernel setup.
PATCH 1/1 MIPS: Add severity levels to printk statements during kernel setup.
--- arch/mips/kernel/setup.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-)
arch/mips/kernel/setup.c +7 -7
@@ -78,7 +78,7 @@ void __init add_memory_region(phys_t start, phys_t size, long type)/* Sanity check */ if (start + size < start) { -printk ("Trying to add an invalid memory region, skipped\n" ); +printk (KERN_WARNING "Trying to add an invalid memory region, skipped\n" );return ; }
@@ -92,7 +92,7 @@ void __init add_memory_region(phys_t start, phys_t size, long type) }if (x ==BOOT_MEM_MAP_MAX ) { -printk ("Ooops! Too many entries in the memory map!\n" ); +printk (KERN_ERR "Ooops! Too many entries in the memory map!\n" );return ; }
@@ -108,7 +108,7 @@ static void __init print_memory_map(void)const int field =2 *sizeof (unsigned long );for (i =0 ; i < boot_mem_map.nr_map; i++) { -printk (" memory: %0*Lx @ %0*Lx " , +printk (KERN_INFO " memory: %0*Lx @ %0*Lx " , field, (unsigned long long ) boot_mem_map.map[i].size, field, (unsigned long long ) boot_mem_map.map[i].addr);
@@ -221,7 +221,7 @@ static void __init finalize_initrd(void) goto disable; }if (__pa (initrd_end) >PFN_PHYS (max_low_pfn)) { -printk ("Initrd extends beyond end of memory" ); +printk (KERN_ERR "Initrd extends beyond end of memory" ); goto disable; }
@@ -232,7 +232,7 @@ static void __init finalize_initrd(void) initrd_start, size);return ; disable: -printk (" - disabling initrd\n" ); +printk (KERN_ERR " - disabling initrd\n" ); initrd_start =0 ; initrd_end =0 ; }
@@ -471,7 +471,7 @@ static void __init arch_mem_init(char **cmdline_p)/* call board setup routine */ plat_mem_setup (); -printk ("Determined physical RAM map:\n" ); +printk (KERN_INFO "Determined physical RAM map:\n" );print_memory_map ();strlcpy (command_line, arcs_cmdline,sizeof (command_line));
@@ -482,7 +482,7 @@ static void __init arch_mem_init(char **cmdline_p)parse_early_param ();if (usermem) { -printk ("User-defined physical RAM map:\n" ); +printk (KERN_INFO "User-defined physical RAM map:\n" );print_memory_map (); }
Signature · 1 line
1.5.6
Quoted 10 lines · Mike Crowe
Signed-off-by Mike Crowe <[email protected]>--- arch/mips/kernel/setup.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-)arch/mips/kernel/setup.c +0
-0
arch/mips/kernel/setup.c void __init add_memory_region(phys_t start, phys_t size, long type) · line 81
Quoted 5 lines
arch/mips/kernel/setup.c +1
-1@@ -78,7 +78,7 @@ void __init add_memory_region(phys_t start, phys_t size, long type)/* Sanity check */ if (start + size < start) { -printk ("Trying to add an invalid memory region, skipped\n" ); +printk (KERN_WARNING "Trying to add an invalid memory region, skipped\n" );
Why not convert to pr_warning(), while you're at it?
arch/mips/kernel/setup.c static void __init finalize_initrd(void) · line 224
Quoted 6 lines
arch/mips/kernel/setup.c +1
-1@@ -221,7 +221,7 @@ static void __init finalize_initrd(void) goto disable; }if (__pa (initrd_end) >PFN_PHYS (max_low_pfn)) { -printk ("Initrd extends beyond end of memory" ); +printk (KERN_ERR "Initrd extends beyond end of memory" );
^
There's no newline here, so...
arch/mips/kernel/setup.c static void __init finalize_initrd(void) · line 235
Quoted 9 lines
arch/mips/kernel/setup.c +1
-1goto disable; }@@ -232,7 +232,7 @@ static void __init finalize_initrd(void) initrd_start, size);return ; disable: -printk (" - disabling initrd\n" ); +printk (KERN_ERR " - disabling initrd\n" );
^^^^^^^^
... probably this should be KERN_CONT.
Note that I didn't check the other paths to get here.
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
Quoted 8 lines · On Fri, 25 Jul 2008, I wrote:
Quoted 8 lines
arch/mips/kernel/setup.c +1
-1@@ -78,7 +78,7 @@ void __init add_memory_region(phys_t start, phys_t size, long type)/* Sanity check */ if (start + size < start) { -printk ("Trying to add an invalid memory region, skipped\n" ); +printk (KERN_WARNING "Trying to add an invalid memory region, skipped\n" );
Quoted 1 line · Geert Uytterhoeven
Why not convert to
pr_warning(), while you're at it?
I can do. I'm just a bit behind the times. :-)
Should I use pr_{warning,err,info} everywhere rather than printk? Is it worth fixing up the other calls to printk that I didn't need to "fix"?
Quoted 19 lines
arch/mips/kernel/setup.c static void __init finalize_initrd(void) · line 224
Quoted 6 lines
arch/mips/kernel/setup.c +1
-1@@ -221,7 +221,7 @@ static void __init finalize_initrd(void) goto disable; }if (__pa (initrd_end) >PFN_PHYS (max_low_pfn)) { -printk ("Initrd extends beyond end of memory" ); +printk (KERN_ERR "Initrd extends beyond end of memory" );^There's no newline here, so...
arch/mips/kernel/setup.c static void __init finalize_initrd(void) · line 235
Quoted 9 lines
arch/mips/kernel/setup.c +1
-1goto disable; }@@ -232,7 +232,7 @@ static void __init finalize_initrd(void) initrd_start, size);return ; disable: -printk (" - disabling initrd\n" ); +printk (KERN_ERR " - disabling initrd\n" );^^^^^^^^
Quoted 2 lines
... probably this should be
KERN_CONT.
Note that I didn't check the other paths to get here.
Well spotted. I thought I'd checked those but obviously not carefully enough. I shall try again.
Thanks.
Mike.
Quoted 11 lines · Mike Crowe
Quoted 8 lines · On Fri, 25 Jul 2008, I wrote:
arch/mips/kernel/setup.c void __init add_memory_region(phys_t start, phys_t size, long type) · line 81
Quoted 8 lines
arch/mips/kernel/setup.c +1
-1@@ -78,7 +78,7 @@ void __init add_memory_region(phys_t start, phys_t size, long type)/* Sanity check */ if (start + size < start) { -printk ("Trying to add an invalid memory region, skipped\n" ); +printk (KERN_WARNING "Trying to add an invalid memory region, skipped\n" );On Fri, Jul 25, 2008 at 08:04:57PM +0200, Geert Uytterhoeven wrote:
Quoted 5 lines
Quoted 1 line
Why not convert to
pr_warning(), while you're at it?I can do. I'm just a bit behind the times. :-)
Should I use pr_{warning,err,info} everywhere rather than printk? Is
Yes, please.
Quoted 2 lines
it worth fixing up the other calls to printk that I didn't need to "fix"?
If you have the time, you can do that. It also makes those (typically too long) lines a bit shorter.
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
PATCH 1/1 MIPS: Convert printk statements during kernel setup to use severity levels
---
I've modified my original patch to use pr_* where appropriate. I've left the two groups that rely on KERN_CONT using printk directly because there is (understandably) no pr_cont.
arch/mips/kernel/setup.c +20 -22
@@ -78,7 +78,7 @@ void __init add_memory_region(phys_t start, phys_t size, long type)/* Sanity check */ if (start + size < start) { -printk ("Trying to add an invalid memory region, skipped\n" ); +pr_warning ("Trying to add an invalid memory region, skipped\n" );return ; }
@@ -92,7 +92,7 @@ void __init add_memory_region(phys_t start, phys_t size, long type) }if (x ==BOOT_MEM_MAP_MAX ) { -printk ("Ooops! Too many entries in the memory map!\n" ); +pr_err ("Ooops! Too many entries in the memory map!\n" );return ; }
@@ -108,22 +108,22 @@ static void __init print_memory_map(void)const int field =2 *sizeof (unsigned long );for (i =0 ; i < boot_mem_map.nr_map; i++) { -printk (" memory: %0*Lx @ %0*Lx " , +printk (KERN_INFO " memory: %0*Lx @ %0*Lx " , field, (unsigned long long ) boot_mem_map.map[i].size, field, (unsigned long long ) boot_mem_map.map[i].addr);switch (boot_mem_map.map[i].type) {case BOOT_MEM_RAM : -printk ("(usable)\n" ); +printk (KERN_CONT "(usable)\n" );break ;case BOOT_MEM_ROM_DATA : -printk ("(ROM data)\n" ); +printk (KERN_CONT "(ROM data)\n" );break ;case BOOT_MEM_RESERVED : -printk ("(reserved)\n" ); +printk (KERN_CONT "(reserved)\n" );break ;default : -printk ("type %lu\n" , boot_mem_map.map[i].type); +printk (KERN_CONT "type %lu\n" , boot_mem_map.map[i].type);break ; } }
@@ -185,11 +185,11 @@ static unsigned long __init init_initrd(void) sanitize:if (initrd_start & ~PAGE_MASK ) { -printk (KERN_ERR "initrd start must be page aligned\n" ); +pr_err ("initrd start must be page aligned\n" ); goto disable; }if (initrd_start <PAGE_OFFSET ) { -printk (KERN_ERR "initrd start < PAGE_OFFSET\n" ); +pr_err ("initrd start < PAGE_OFFSET\n" ); goto disable; }
@@ -221,18 +221,18 @@ static void __init finalize_initrd(void) goto disable; }if (__pa (initrd_end) >PFN_PHYS (max_low_pfn)) { -printk ("Initrd extends beyond end of memory" ); +printk (KERN_ERR "Initrd extends beyond end of memory" ); goto disable; }reserve_bootmem (__pa (initrd_start), size,BOOTMEM_DEFAULT ); initrd_below_start_ok =1 ; -printk (KERN_INFO "Initial ramdisk at: 0x%lx (%lu bytes)\n" , - initrd_start, size); +pr_info ("Initial ramdisk at: 0x%lx (%lu bytes)\n" , + initrd_start, size);return ; disable: -printk (" - disabling initrd\n" ); +printk (KERN_CONT " - disabling initrd\n" ); initrd_start =0 ; initrd_end =0 ; }
@@ -310,14 +310,12 @@ static void __init bootmem_init(void)if (min_low_pfn >= max_low_pfn)panic ("Incorrect memory mapping !!!" );if (min_low_pfn >ARCH_PFN_OFFSET ) { -printk (KERN_INFO -"Wasting %lu bytes for tracking %lu unused pages\n" , - (min_low_pfn -ARCH_PFN_OFFSET ) *sizeof (struct page ), - min_low_pfn -ARCH_PFN_OFFSET ); +pr_info ("Wasting %lu bytes for tracking %lu unused pages\n" , + (min_low_pfn -ARCH_PFN_OFFSET ) *sizeof (struct page ), + min_low_pfn -ARCH_PFN_OFFSET ); }else if (min_low_pfn <ARCH_PFN_OFFSET ) { -printk (KERN_INFO -"%lu free pages won't be used\n" , -ARCH_PFN_OFFSET - min_low_pfn); +pr_info ("%lu free pages won't be used\n" , +ARCH_PFN_OFFSET - min_low_pfn); } min_low_pfn =ARCH_PFN_OFFSET ;
@@ -471,7 +469,7 @@ static void __init arch_mem_init(char **cmdline_p)/* call board setup routine */ plat_mem_setup (); -printk ("Determined physical RAM map:\n" ); +pr_info ("Determined physical RAM map:\n" );print_memory_map ();strlcpy (command_line, arcs_cmdline,sizeof (command_line));
@@ -482,7 +480,7 @@ static void __init arch_mem_init(char **cmdline_p)parse_early_param ();if (usermem) { -printk ("User-defined physical RAM map:\n" ); +pr_info ("User-defined physical RAM map:\n" );print_memory_map (); }
Signature · 1 line
1.5.6
Ralf Baechle
AppliedRe: [PATCH] MIPS: Convert printk statements during kernel setup to use severity levels
Quoted 9 lines · Mike Crowe
From: Mike Crowe <[email protected]>
Date: Mon, 28 Jul 2008 13:12:52 +0100
To: [email protected]
Cc: Geert Uytterhoeven <[email protected]>
Subject: [PATCH] MIPS: Convert printk statements during kernel setup to use
severity levels
Content-Type: text/plain; charset=us-asciiSigned-off-by Mike Crowe <[email protected]>
Thanks, applied.
Ralf