ACPI: lockdep warning on boot, 2.6.25-rc5
[sfrench/cifs-2.6.git] / drivers / acpi / processor_idle.c
index baa389b908e2bd827f1b22cf6619bf6e585f2e81..e8e2d88692368f5ea4903485aa7ca6a6b783e493 100644 (file)
@@ -216,8 +216,10 @@ static void acpi_safe_halt(void)
         * test NEED_RESCHED:
         */
        smp_mb();
-       if (!need_resched())
+       if (!need_resched()) {
                safe_halt();
+               local_irq_disable();
+       }
        current_thread_info()->status |= TS_POLLING;
 }
 
@@ -364,7 +366,7 @@ int acpi_processor_resume(struct acpi_device * device)
        return 0;
 }
 
-#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86_TSC)
+#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86)
 static int tsc_halts_in_c(int state)
 {
        switch (boot_cpu_data.x86_vendor) {
@@ -421,7 +423,9 @@ static void acpi_processor_idle(void)
                else
                        acpi_safe_halt();
 
-               local_irq_enable();
+               if (irqs_disabled())
+                       local_irq_enable();
+
                return;
        }
 
@@ -530,7 +534,9 @@ static void acpi_processor_idle(void)
                 *       skew otherwise.
                 */
                sleep_ticks = 0xFFFFFFFF;
-               local_irq_enable();
+               if (irqs_disabled())
+                       local_irq_enable();
+
                break;
 
        case ACPI_STATE_C2:
@@ -544,7 +550,7 @@ static void acpi_processor_idle(void)
                /* Get end time (ticks) */
                t2 = inl(acpi_gbl_FADT.xpm_timer_block.address);
 
-#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86_TSC)
+#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86)
                /* TSC halts in C2, so notify users */
                if (tsc_halts_in_c(ACPI_STATE_C2))
                        mark_tsc_unstable("possible TSC halt in C2");
@@ -609,7 +615,7 @@ static void acpi_processor_idle(void)
                        acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0);
                }
 
-#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86_TSC)
+#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86)
                /* TSC halts in C3, so notify users */
                if (tsc_halts_in_c(ACPI_STATE_C3))
                        mark_tsc_unstable("TSC halts in C3");
@@ -1425,6 +1431,14 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,
                return 0;
 
        local_irq_disable();
+
+       /* Do not access any ACPI IO ports in suspend path */
+       if (acpi_idle_suspend) {
+               acpi_safe_halt();
+               local_irq_enable();
+               return 0;
+       }
+
        if (pr->flags.bm_check)
                acpi_idle_update_bm_rld(pr, cx);
 
@@ -1492,7 +1506,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
        acpi_idle_do_entry(cx);
        t2 = inl(acpi_gbl_FADT.xpm_timer_block.address);
 
-#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86_TSC)
+#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86)
        /* TSC could halt in idle, so notify users */
        if (tsc_halts_in_c(cx->type))
                mark_tsc_unstable("TSC halts in idle");;
@@ -1606,7 +1620,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
                spin_unlock(&c3_lock);
        }
 
-#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86_TSC)
+#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86)
        /* TSC could halt in idle, so notify users */
        if (tsc_halts_in_c(ACPI_STATE_C3))
                mark_tsc_unstable("TSC halts in idle");