init: main: fixed coding style issues and errors
PATCH 1/1 init: main: fixed coding style issues and errors
From: Odinn <odinn@ubuntu.(none)>
Fixed coding style issues regarding spaces and braces. Removed init of a static variable.
Added KERN_DEBUG to printk that was missing it
--- init/main.c | 52 +++++++++++++++++++++++++--------------------------- 1 file changed, 25 insertions(+), 27 deletions(-)
init/main.c +25 -27
@@ -6,7 +6,7 @@* GK 2/5/95 - Changed to support mounting root fs via NFS * Added initrd & change_root: Werner Almesberger & Hans Lermen, Feb '96 * Moan early if gcc is old, avoiding bogus kernels - Paul Gortmaker, May '96 -* Simplified starting of init: Michael A. Griffith <[email protected]> +* Simplified starting of init: Michael A. Griffith <[email protected]> */ #include <linux/types.h>
@@ -71,14 +71,14 @@#include <linux/file.h> #include <linux/ptrace.h> -#include <asm/io.h> +#include <linux/io.h> #include <asm/bugs.h> #include <asm/setup.h> #include <asm/sections.h> #include <asm/cacheflush.h> #ifdef CONFIG_X86_LOCAL_APIC -#include <asm/smp.h> +#include <linux/smp.h> #endif static int kernel_init (void *);
@@ -149,8 +149,8 @@ static int __init set_reset_devices(char *str)__setup ("reset_devices" , set_reset_devices); -static const char * argv_init[MAX_INIT_ARGS +2 ] = {"init" ,NULL , }; -const char * envp_init[MAX_INIT_ENVS +2 ] = {"HOME=/" ,"TERM=linux" ,NULL , }; +static const char *argv_init[MAX_INIT_ARGS +2 ] = {"init" ,NULL , }; +const char *envp_init[MAX_INIT_ENVS +2 ] = {"HOME=/" ,"TERM=linux" ,NULL , };static const char *panic_later, *panic_param;extern const struct obs_kernel_param __setup_start[], __setup_end[];
@@ -172,8 +172,8 @@ static int __init obsolete_checksetup(char *line)if (line[n] =='\0' || line[n] =='=' ) had_early_param =1 ; }else if (!p->setup_func) { -printk (KERN_WARNING "Parameter %s is obsolete," -" ignored\n" , p->str); +printk (KERN_WARNING "Parameter %s is obsolete" \ +", ignored\n" , p->str);return 1 ; }else if (p->setup_func (line + n))return 1 ;
@@ -189,7 +189,6 @@ static int __init obsolete_checksetup(char *line)* still work even if initially too large, it will just take slightly longer */ unsigned long loops_per_jiffy = (1 <<12 ); -EXPORT_SYMBOL (loops_per_jiffy);static int __init debug_kernel (char *str)
@@ -340,10 +339,10 @@ static inline void smp_prepare_cpus(unsigned int maxcpus) { }*/ static void __init setup_command_line (char *command_line) { - saved_command_line =alloc_bootmem (strlen (boot_command_line)+1 ); - static_command_line =alloc_bootmem (strlen (command_line)+1 ); -strcpy (saved_command_line, boot_command_line); -strcpy (static_command_line, command_line); + saved_command_line =alloc_bootmem (strlen (boot_command_line)+1 ); + static_command_line =alloc_bootmem (strlen (command_line)+1 ); +strcpy (saved_command_line, boot_command_line); +strcpy (static_command_line, command_line); }/*
@@ -412,7 +411,7 @@ void __init parse_early_options(char *cmdline)/* Arch code calls this early on, or if not, just before other parsing. */ void __init parse_early_param (void ) { -static __initdata int done =0 ; +static __initdata int done;static __initdata char tmp_cmdline[COMMAND_LINE_SIZE ];if (done)
@@ -465,7 +464,7 @@ static void __init mm_init(void) asmlinkage void __init start_kernel(void) { -char * command_line; +char *command_line;extern const struct kernel_param __start___param[], __stop___param[];/*
@@ -536,8 +535,8 @@ asmlinkage void __init start_kernel(void)*/ preempt_disable ();if (!irqs_disabled ()) { -printk (KERN_WARNING "start_kernel(): bug: interrupts were " -"enabled *very* early, fixing it\n" ); +printk (KERN_WARNING "start_kernel(): bug: interrupts were" \ +" enabled *very* early, fixing it\n" );local_irq_disable (); }idr_init_cache ();
@@ -555,8 +554,8 @@ asmlinkage void __init start_kernel(void)profile_init ();call_function_init ();if (!irqs_disabled ()) -printk (KERN_CRIT "start_kernel(): bug: interrupts were " -"enabled early\n" ); +printk (KERN_CRIT "start_kernel(): bug: interrupts" \ +" were enabled early\n" ); early_boot_irqs_disabled = false;local_irq_enable ();
@@ -583,8 +582,8 @@ asmlinkage void __init start_kernel(void)#ifdef CONFIG_BLK_DEV_INITRD if (initrd_start && !initrd_below_start_ok &&page_to_pfn (virt_to_page ((void *)initrd_start)) < min_low_pfn) { -printk (KERN_CRIT "initrd overwritten (0x%08lx < 0x%08lx) - " -"disabling it.\n" , +printk (KERN_CRIT "initrd overwritten (0x%08lx < 0x%08lx)" \ +" - disabling it.\n" ,page_to_pfn (virt_to_page ((void *)initrd_start)), min_low_pfn); initrd_start =0 ;
@@ -698,9 +697,8 @@ int __init_or_module do_one_initcall(initcall_t fn)strlcat (msgbuf,"disabled interrupts " ,sizeof (msgbuf));local_irq_enable (); } -if (msgbuf[0 ]) { -printk ("initcall %pF returned with %s\n" , fn, msgbuf); - } +if (msgbuf[0 ]) +printk (KERN_DEBUG "initcall %pF returned with %s\n" , fn, msgbuf);return ret; }
@@ -829,8 +827,8 @@ static int __ref kernel_init(void *unused)if (execute_command) {if (!run_init_process (execute_command))return 0 ; -printk (KERN_WARNING "Failed to execute %s. Attempting " -"defaults...\n" , execute_command); +printk (KERN_WARNING "Failed to execute %s. Attempting" \ +" defaults...\n" , execute_command); } if (!run_init_process("/sbin/init") || !run_init_process("/etc/init") ||
@@ -838,8 +836,8 @@ static int __ref kernel_init(void *unused) !run_init_process("/bin/sh"))return 0 ; -panic ("No init found. Try passing init= option to kernel. " -"See Linux Documentation/init.txt for guidance." ); +panic ("No init found. Try passing init= option to kernel" \ +". See Linux Documentation/init.txt for guidance." ); }static void __init kernel_init_freeable (void )
Signature · 1 line
1.7.9.5
Quoted 1 line · Levan Giguashvili
From: Odinn <odinn@ubuntu.(none)>
who's that? Make sure your from line is correct please.
Quoted 3 lines
Fixed coding style issues regarding spaces and braces. Removed init of a static variable.
AddedKERN_DEBUGto printk that was missing it
Added unnecessary continuation lines to printks.
init/main.c
Quoted 1 line
init/main.c +0
-0
[]
init/main.c static int __init obsolete_checksetup(char *line) · line 176
Quoted 8 lines
init/main.c +2
-2@@ -172,8 +172,8 @@ static int __init obsolete_checksetup(char *line)if (line[n] =='\0' || line[n] =='=' ) had_early_param =1 ; }else if (!p->setup_func) { -printk (KERN_WARNING "Parameter %s is obsolete," -" ignored\n" , p->str); +printk (KERN_WARNING "Parameter %s is obsolete" \ +", ignored\n" , p->str);
Don't add unnecessary line continuations please. Better would be to coalesce the formats like:
printk(KERN_WARNING "Parameter %s is obsolete, ignored\n" p->str);
It would also be better and easier to review if you broke out the whitespace only changes as a separate patch from the other changes you make.
Oh, and please make these sorts of changes only in the drivers/staging tree until you are _very_ familiar with kernel style. Don't rely on checkpatch to tell you what to do. It's pretty brain-dead. checkpatch is a patch checking tool not really a code style tool for existing code.