uml: host_info tidying
[powerpc.git] / arch / um / kernel / um_arch.c
index 97d88e7..613fb08 100644 (file)
@@ -3,7 +3,6 @@
  * Licensed under the GPL
  */
 
-#include "linux/config.h"
 #include "linux/kernel.h"
 #include "linux/sched.h"
 #include "linux/notifier.h"
@@ -18,6 +17,7 @@
 #include "linux/seq_file.h"
 #include "linux/delay.h"
 #include "linux/module.h"
+#include "linux/utsname.h"
 #include "asm/page.h"
 #include "asm/pgtable.h"
 #include "asm/ptrace.h"
@@ -31,7 +31,6 @@
 #include "kern.h"
 #include "mem_user.h"
 #include "mem.h"
-#include "umid.h"
 #include "initrd.h"
 #include "init.h"
 #include "os.h"
@@ -45,9 +44,9 @@
 #define DEFAULT_COMMAND_LINE "root=98:0"
 
 /* Changed in linux_main and setup_arch, which run before SMP is started */
-static char command_line[COMMAND_LINE_SIZE] = { 0 };
+static char __initdata command_line[COMMAND_LINE_SIZE] = { 0 };
 
-static void add_arg(char *arg)
+static void __init add_arg(char *arg)
 {
        if (strlen(command_line) + strlen(arg) + 1 > COMMAND_LINE_SIZE) {
                printf("add_arg: Too many command line arguments!\n");
@@ -65,10 +64,13 @@ struct cpuinfo_um boot_cpu_data = {
 
 unsigned long thread_saved_pc(struct task_struct *task)
 {
-       return(os_process_pc(CHOOSE_MODE_PROC(thread_pid_tt, thread_pid_skas,
-                                             task)));
+       return os_process_pc(CHOOSE_MODE_PROC(thread_pid_tt, thread_pid_skas,
+                                             task));
 }
 
+/* Changed in setup_arch, which is called in early boot */
+static char host_info[(__NEW_UTS_LEN + 1) * 5];
+
 static int show_cpuinfo(struct seq_file *m, void *v)
 {
        int index = 0;
@@ -88,7 +90,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
                   loops_per_jiffy/(500000/HZ),
                   (loops_per_jiffy/(5000/HZ)) % 100);
 
-       return(0);
+       return 0;
 }
 
 static void *c_start(struct seq_file *m, loff_t *pos)
@@ -214,12 +216,12 @@ __uml_setup("debug", no_skas_debug_setup,
 #ifdef CONFIG_SMP
 static int __init uml_ncpus_setup(char *line, int *add)
 {
-       if (!sscanf(line, "%d", &ncpus)) {
-               printf("Couldn't parse [%s]\n", line);
-               return -1;
-       }
+       if (!sscanf(line, "%d", &ncpus)) {
+               printf("Couldn't parse [%s]\n", line);
+               return -1;
+       }
 
-       return 0;
+       return 0;
 }
 
 __uml_setup("ncpus=", uml_ncpus_setup,
@@ -236,7 +238,7 @@ static int force_tt = 0;
 static int __init mode_tt_setup(char *line, int *add)
 {
        force_tt = 1;
-       return(0);
+       return 0;
 }
 
 #else
@@ -247,7 +249,7 @@ static int __init mode_tt_setup(char *line, int *add)
 static int __init mode_tt_setup(char *line, int *add)
 {
        printf("CONFIG_MODE_TT disabled - 'mode=tt' ignored\n");
-       return(0);
+       return 0;
 }
 
 #else
@@ -258,7 +260,7 @@ static int __init mode_tt_setup(char *line, int *add)
 static int __init mode_tt_setup(char *line, int *add)
 {
        printf("CONFIG_MODE_SKAS disabled - 'mode=tt' redundant\n");
-       return(0);
+       return 0;
 }
 
 #endif
@@ -276,16 +278,15 @@ int mode_tt = DEFAULT_TT;
 
 static int __init Usage(char *line, int *add)
 {
-       const char **p;
+       const char **p;
 
        printf(usage_string, init_utsname()->release);
-       p = &__uml_help_start;
-       while (p < &__uml_help_end) {
-               printf("%s", *p);
-               p++;
-       }
+       p = &__uml_help_start;
+       while (p < &__uml_help_end) {
+               printf("%s", *p);
+               p++;
+       }
        exit(0);
-
        return 0;
 }
 
@@ -332,7 +333,7 @@ EXPORT_SYMBOL(end_iomem);
 
 extern char __binary_start;
 
-int linux_main(int argc, char **argv)
+int __init linux_main(int argc, char **argv)
 {
        unsigned long avail, diff;
        unsigned long virtmem_size, max_physmem;
@@ -381,8 +382,8 @@ int linux_main(int argc, char **argv)
                                          set_task_sizes_skas, &task_size);
 
        /*
-        * Setting up handlers to 'sig_info' struct
-        */
+        * Setting up handlers to 'sig_info' struct
+        */
        os_fill_handlinfo(handlinfo_kern);
 
        brk_start = (unsigned long) sbrk(0);
@@ -409,7 +410,7 @@ int linux_main(int argc, char **argv)
        argv1_begin = argv[1];
        argv1_end = &argv[1][strlen(argv[1])];
 #endif
-  
+
        highmem = 0;
        iomem_size = (iomem_size + PAGE_SIZE - 1) & PAGE_MASK;
        max_physmem = get_kmem_end() - uml_physmem - iomem_size - MIN_VMALLOC;
@@ -451,12 +452,12 @@ int linux_main(int argc, char **argv)
                printf("Kernel virtual memory size shrunk to %lu bytes\n",
                       virtmem_size);
 
-       uml_postsetup();
+       uml_postsetup();
 
        task_protections((unsigned long) &init_thread_info);
        os_flush_stdout();
 
-       return(CHOOSE_MODE(start_uml_tt(), start_uml_skas()));
+       return CHOOSE_MODE(start_uml_tt(), start_uml_skas());
 }
 
 extern int uml_exitcode;
@@ -469,7 +470,7 @@ static int panic_exit(struct notifier_block *self, unsigned long unused1,
        bust_spinlocks(0);
        uml_exitcode = 1;
        machine_halt();
-       return(0);
+       return 0;
 }
 
 static struct notifier_block panic_exit_notifier = {
@@ -483,15 +484,15 @@ void __init setup_arch(char **cmdline_p)
        atomic_notifier_chain_register(&panic_notifier_list,
                        &panic_exit_notifier);
        paging_init();
-        strlcpy(saved_command_line, command_line, COMMAND_LINE_SIZE);
-       *cmdline_p = command_line;
-       setup_hostinfo();
+       strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
+       *cmdline_p = command_line;
+       setup_hostinfo(host_info, sizeof host_info);
 }
 
 void __init check_bugs(void)
 {
        arch_check_bugs();
-       os_check_bugs();
+       os_check_bugs();
 }
 
 void apply_alternatives(struct alt_instr *start, struct alt_instr *end)