]> Pileus Git - ~andy/linux/blobdiff - drivers/acpi/processor_idle.c
net: mvneta: use devm_ioremap_resource() instead of of_iomap()
[~andy/linux] / drivers / acpi / processor_idle.c
index f90c56c8379e8c9c69d99a0a5366780a850fe3b9..3dca36d4ad26ef22d6ecea66e166ae22cde9ab33 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:
@@ -780,6 +778,13 @@ static int acpi_idle_enter_simple(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
+
        /*
         * Must be done before busmaster disable as we might need to
         * access HPET !
@@ -821,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,
@@ -917,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++;
@@ -930,8 +936,6 @@ static int acpi_processor_setup_cpuidle_cx(struct acpi_processor *pr,
                        break;
        }
 
-       dev->state_count = count;
-
        if (!count)
                return -EINVAL;
 
@@ -972,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);