autofs4: add missing kfree
[pandora-kernel.git] / init / main.c
index c622151..2769dc0 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/kernel_stat.h>
 #include <linux/start_kernel.h>
 #include <linux/security.h>
+#include <linux/smp.h>
 #include <linux/workqueue.h>
 #include <linux/profile.h>
 #include <linux/rcupdate.h>
@@ -414,6 +415,13 @@ static void __init smp_init(void)
 {
        unsigned int cpu;
 
+       /*
+        * Set up the current CPU as possible to migrate to.
+        * The other ones will be done by cpu_up/cpu_down()
+        */
+       cpu = smp_processor_id();
+       cpu_set(cpu, cpu_active_map);
+
        /* FIXME: This should be done in userspace --RR */
        for_each_present_cpu(cpu) {
                if (num_online_cpus() >= setup_max_cpus)
@@ -629,9 +637,10 @@ asmlinkage void __init start_kernel(void)
 
 #ifdef CONFIG_BLK_DEV_INITRD
        if (initrd_start && !initrd_below_start_ok &&
-                       initrd_start < min_low_pfn << PAGE_SHIFT) {
+           page_to_pfn(virt_to_page(initrd_start)) < min_low_pfn) {
                printk(KERN_CRIT "initrd overwritten (0x%08lx < 0x%08lx) - "
-                   "disabling it.\n",initrd_start,min_low_pfn << PAGE_SHIFT);
+                   "disabling it.\n",
+                   page_to_pfn(virt_to_page(initrd_start)), min_low_pfn);
                initrd_start = 0;
        }
 #endif
@@ -693,52 +702,57 @@ static int __init initcall_debug_setup(char *str)
 }
 __setup("initcall_debug", initcall_debug_setup);
 
-extern initcall_t __initcall_start[], __initcall_end[];
-
-static void __init do_initcalls(void)
+static void __init do_one_initcall(initcall_t fn)
 {
-       initcall_t *call;
        int count = preempt_count();
+       ktime_t t0, t1, delta;
+       char msgbuf[64];
+       int result;
 
-       for (call = __initcall_start; call < __initcall_end; call++) {
-               ktime_t t0, t1, delta;
-               char msgbuf[40];
-               int result;
-
-               if (initcall_debug) {
-                       print_fn_descriptor_symbol("calling  %s\n", *call);
-                       t0 = ktime_get();
-               }
+       if (initcall_debug) {
+               print_fn_descriptor_symbol("calling  %s\n", fn);
+               t0 = ktime_get();
+       }
 
-               result = (*call)();
+       result = fn();
 
-               if (initcall_debug) {
-                       t1 = ktime_get();
-                       delta = ktime_sub(t1, t0);
+       if (initcall_debug) {
+               t1 = ktime_get();
+               delta = ktime_sub(t1, t0);
 
-                       print_fn_descriptor_symbol("initcall %s", *call);
-                       printk(" returned %d after %Ld msecs\n", result,
-                               (unsigned long long) delta.tv64 >> 20);
-               }
+               print_fn_descriptor_symbol("initcall %s", fn);
+               printk(" returned %d after %Ld msecs\n", result,
+                       (unsigned long long) delta.tv64 >> 20);
+       }
 
-               msgbuf[0] = 0;
+       msgbuf[0] = 0;
 
-               if (result && result != -ENODEV && initcall_debug)
-                       sprintf(msgbuf, "error code %d ", result);
+       if (result && result != -ENODEV && initcall_debug)
+               sprintf(msgbuf, "error code %d ", result);
 
-               if (preempt_count() != count) {
-                       strncat(msgbuf, "preemption imbalance ", sizeof(msgbuf));
-                       preempt_count() = count;
-               }
-               if (irqs_disabled()) {
-                       strncat(msgbuf, "disabled interrupts ", sizeof(msgbuf));
-                       local_irq_enable();
-               }
-               if (msgbuf[0]) {
-                       print_fn_descriptor_symbol(KERN_WARNING "initcall %s", *call);
-                       printk(" returned with %s\n", msgbuf);
-               }
+       if (preempt_count() != count) {
+               strlcat(msgbuf, "preemption imbalance ", sizeof(msgbuf));
+               preempt_count() = count;
+       }
+       if (irqs_disabled()) {
+               strlcat(msgbuf, "disabled interrupts ", sizeof(msgbuf));
+               local_irq_enable();
+       }
+       if (msgbuf[0]) {
+               print_fn_descriptor_symbol(KERN_WARNING "initcall %s", fn);
+               printk(" returned with %s\n", msgbuf);
        }
+}
+
+
+extern initcall_t __initcall_start[], __initcall_end[];
+
+static void __init do_initcalls(void)
+{
+       initcall_t *call;
+
+       for (call = __initcall_start; call < __initcall_end; call++)
+               do_one_initcall(*call);
 
        /* Make sure there is no pending stuff from the initcall sequence */
        flush_scheduled_work();
@@ -753,6 +767,7 @@ static void __init do_initcalls(void)
  */
 static void __init do_basic_setup(void)
 {
+       rcu_init_sched(); /* needed by module_init stage. */
        /* drivers will send hotplug events */
        init_workqueues();
        usermodehelper_init();
@@ -774,6 +789,7 @@ static void __init do_pre_smp_initcalls(void)
 {
        extern int spawn_ksoftirqd(void);
 
+       init_call_single_data();
        migration_init();
        spawn_ksoftirqd();
        if (!nosoftlockup)