Pull release into acpica branch
[pandora-kernel.git] / arch / arm / kernel / process.c
index bbea636..30494aa 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/interrupt.h>
 #include <linux/kallsyms.h>
 #include <linux/init.h>
+#include <linux/cpu.h>
 
 #include <asm/system.h>
 #include <asm/io.h>
@@ -85,12 +86,16 @@ EXPORT_SYMBOL(pm_power_off);
  */
 void default_idle(void)
 {
-       local_irq_disable();
-       if (!need_resched() && !hlt_counter) {
-               timer_dyn_reprogram();
-               arch_idle();
+       if (hlt_counter)
+               cpu_relax();
+       else {
+               local_irq_disable();
+               if (!need_resched()) {
+                       timer_dyn_reprogram();
+                       arch_idle();
+               }
+               local_irq_enable();
        }
-       local_irq_enable();
 }
 
 /*
@@ -105,15 +110,23 @@ void cpu_idle(void)
        /* endless idle loop with no priority at all */
        while (1) {
                void (*idle)(void) = pm_idle;
+
+#ifdef CONFIG_HOTPLUG_CPU
+               if (cpu_is_offline(smp_processor_id())) {
+                       leds_event(led_idle_start);
+                       cpu_die();
+               }
+#endif
+
                if (!idle)
                        idle = default_idle;
-               preempt_disable();
                leds_event(led_idle_start);
                while (!need_resched())
                        idle();
                leds_event(led_idle_end);
-               preempt_enable();
+               preempt_enable_no_resched();
                schedule();
+               preempt_disable();
        }
 }
 
@@ -131,7 +144,6 @@ void machine_halt(void)
 {
 }
 
-EXPORT_SYMBOL(machine_halt);
 
 void machine_power_off(void)
 {
@@ -139,7 +151,6 @@ void machine_power_off(void)
                pm_power_off();
 }
 
-EXPORT_SYMBOL(machine_power_off);
 
 void machine_restart(char * __unused)
 {
@@ -169,8 +180,6 @@ void machine_restart(char * __unused)
        while (1);
 }
 
-EXPORT_SYMBOL(machine_restart);
-
 void __show_regs(struct pt_regs *regs)
 {
        unsigned long flags = condition_codes(regs);
@@ -350,7 +359,7 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long stack_start,
        struct thread_info *thread = p->thread_info;
        struct pt_regs *childregs;
 
-       childregs = ((struct pt_regs *)((unsigned long)thread + THREAD_START_SP)) - 1;
+       childregs = (void *)thread + THREAD_START_SP - sizeof(*regs);
        *childregs = *regs;
        childregs->ARM_r0 = 0;
        childregs->ARM_sp = stack_start;