Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
[cascardo/linux.git] / drivers / acpi / processor_idle.c
index 644516d..3dca36d 100644 (file)
@@ -35,6 +35,7 @@
 #include <linux/clockchips.h>
 #include <linux/cpuidle.h>
 #include <linux/syscore_ops.h>
+#include <acpi/processor.h>
 
 /*
  * Include the apic definitions for x86 to have the APIC timer related defines
@@ -46,9 +47,6 @@
 #include <asm/apic.h>
 #endif
 
-#include <acpi/acpi_bus.h>
-#include <acpi/processor.h>
-
 #define PREFIX "ACPI: "
 
 #define ACPI_PROCESSOR_CLASS            "processor"
@@ -213,7 +211,7 @@ static int acpi_processor_suspend(void)
 
 static void acpi_processor_resume(void)
 {
-       u32 resumed_bm_rld;
+       u32 resumed_bm_rld = 0;
 
        acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &resumed_bm_rld);
        if (resumed_bm_rld == saved_bm_rld)
@@ -598,7 +596,7 @@ static int acpi_processor_power_verify(struct acpi_processor *pr)
                case ACPI_STATE_C2:
                        if (!cx->address)
                                break;
-                       cx->valid = 1; 
+                       cx->valid = 1;
                        break;
 
                case ACPI_STATE_C3:
@@ -727,11 +725,6 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,
        if (unlikely(!pr))
                return -EINVAL;
 
-       if (cx->entry_method == ACPI_CSTATE_FFH) {
-               if (current_set_polling_and_test())
-                       return -EINVAL;
-       }
-
        lapic_timer_state_broadcast(pr, cx, 1);
        acpi_idle_do_entry(cx);
 
@@ -785,10 +778,12 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
        if (unlikely(!pr))
                return -EINVAL;
 
-       if (cx->entry_method == ACPI_CSTATE_FFH) {
-               if (current_set_polling_and_test())
-                       return -EINVAL;
-       }
+#ifdef CONFIG_HOTPLUG_CPU
+       if ((cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) &&
+           !pr->flags.has_cst &&
+           !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED))
+               return acpi_idle_enter_c1(dev, drv, CPUIDLE_DRIVER_STATE_START);
+#endif
 
        /*
         * Must be done before busmaster disable as we might need to
@@ -831,6 +826,13 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
        if (unlikely(!pr))
                return -EINVAL;
 
+#ifdef CONFIG_HOTPLUG_CPU
+       if ((cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) &&
+           !pr->flags.has_cst &&
+           !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED))
+               return acpi_idle_enter_c1(dev, drv, CPUIDLE_DRIVER_STATE_START);
+#endif
+
        if (!cx->bm_sts_skip && acpi_idle_bm_check()) {
                if (drv->safe_state_index >= 0) {
                        return drv->states[drv->safe_state_index].enter(dev,
@@ -841,11 +843,6 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
                }
        }
 
-       if (cx->entry_method == ACPI_CSTATE_FFH) {
-               if (current_set_polling_and_test())
-                       return -EINVAL;
-       }
-
        acpi_unlazy_tlb(smp_processor_id());
 
        /* Tell the scheduler that we are going deep-idle: */
@@ -932,12 +929,6 @@ static int acpi_processor_setup_cpuidle_cx(struct acpi_processor *pr,
                if (!cx->valid)
                        continue;
 
-#ifdef CONFIG_HOTPLUG_CPU
-               if ((cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) &&
-                   !pr->flags.has_cst &&
-                   !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED))
-                       continue;
-#endif
                per_cpu(acpi_cstate[count], dev->cpu) = cx;
 
                count++;
@@ -945,8 +936,6 @@ static int acpi_processor_setup_cpuidle_cx(struct acpi_processor *pr,
                        break;
        }
 
-       dev->state_count = count;
-
        if (!count)
                return -EINVAL;
 
@@ -987,13 +976,6 @@ static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr)
                if (!cx->valid)
                        continue;
 
-#ifdef CONFIG_HOTPLUG_CPU
-               if ((cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) &&
-                   !pr->flags.has_cst &&
-                   !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED))
-                       continue;
-#endif
-
                state = &drv->states[count];
                snprintf(state->name, CPUIDLE_NAME_LEN, "C%d", i);
                strncpy(state->desc, cx->desc, CPUIDLE_DESC_LEN);