ACPI: Enable ACPI error messages w/o CONFIG_ACPI_DEBUG
[linux-drm-fsl-dcu.git] / drivers / acpi / processor_idle.c
index 80fa43471f484dd68c190d8726086a2e03cc00b3..52ada5322447981f7d47e74efb3a7a5f8f5236b9 100644 (file)
@@ -54,10 +54,10 @@ ACPI_MODULE_NAME("acpi_processor")
 #define US_TO_PM_TIMER_TICKS(t)                ((t * (PM_TIMER_FREQUENCY/1000)) / 1000)
 #define C2_OVERHEAD                    4       /* 1us (3.579 ticks per us) */
 #define C3_OVERHEAD                    4       /* 1us (3.579 ticks per us) */
-static void (*pm_idle_save) (void);
+static void (*pm_idle_save) (void) __read_mostly;
 module_param(max_cstate, uint, 0644);
 
-static unsigned int nocst = 0;
+static unsigned int nocst __read_mostly;
 module_param(nocst, uint, 0000);
 
 /*
@@ -67,7 +67,7 @@ module_param(nocst, uint, 0000);
  * 100 HZ: 0x0000000F: 4 jiffies = 40ms
  * reduce history for more aggressive entry into C3
  */
-static unsigned int bm_history =
+static unsigned int bm_history __read_mostly =
     (HZ >= 800 ? 0xFFFFFFFF : ((1U << (HZ / 25)) - 1));
 module_param(bm_history, uint, 0644);
 /* --------------------------------------------------------------------------
@@ -206,11 +206,11 @@ acpi_processor_power_activate(struct acpi_processor *pr,
 
 static void acpi_safe_halt(void)
 {
-       clear_thread_flag(TIF_POLLING_NRFLAG);
+       current_thread_info()->status &= ~TS_POLLING;
        smp_mb__after_clear_bit();
        if (!need_resched())
                safe_halt();
-       set_thread_flag(TIF_POLLING_NRFLAG);
+       current_thread_info()->status |= TS_POLLING;
 }
 
 static atomic_t c3_cpu_count;
@@ -330,10 +330,10 @@ static void acpi_processor_idle(void)
         * Invoke the current Cx state to put the processor to sleep.
         */
        if (cx->type == ACPI_STATE_C2 || cx->type == ACPI_STATE_C3) {
-               clear_thread_flag(TIF_POLLING_NRFLAG);
+               current_thread_info()->status &= ~TS_POLLING;
                smp_mb__after_clear_bit();
                if (need_resched()) {
-                       set_thread_flag(TIF_POLLING_NRFLAG);
+                       current_thread_info()->status |= TS_POLLING;
                        local_irq_enable();
                        return;
                }
@@ -369,9 +369,14 @@ static void acpi_processor_idle(void)
                t2 = inl(acpi_fadt.xpm_tmr_blk.address);
                /* Get end time (ticks) */
                t2 = inl(acpi_fadt.xpm_tmr_blk.address);
+
+#ifdef CONFIG_GENERIC_TIME
+               /* TSC halts in C2, so notify users */
+               mark_tsc_unstable();
+#endif
                /* Re-enable interrupts */
                local_irq_enable();
-               set_thread_flag(TIF_POLLING_NRFLAG);
+               current_thread_info()->status |= TS_POLLING;
                /* Compute time (ticks) that we were actually asleep */
                sleep_ticks =
                    ticks_elapsed(t1, t2) - cx->latency_ticks - C2_OVERHEAD;
@@ -409,9 +414,13 @@ static void acpi_processor_idle(void)
                                          ACPI_MTX_DO_NOT_LOCK);
                }
 
+#ifdef CONFIG_GENERIC_TIME
+               /* TSC halts in C3, so notify users */
+               mark_tsc_unstable();
+#endif
                /* Re-enable interrupts */
                local_irq_enable();
-               set_thread_flag(TIF_POLLING_NRFLAG);
+               current_thread_info()->status |= TS_POLLING;
                /* Compute time (ticks) that we were actually asleep */
                sleep_ticks =
                    ticks_elapsed(t1, t2) - cx->latency_ticks - C3_OVERHEAD;
@@ -665,8 +674,7 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
 
        /* There must be at least 2 elements */
        if (!cst || (cst->type != ACPI_TYPE_PACKAGE) || cst->package.count < 2) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "not enough elements in _CST\n"));
+               ACPI_ERROR((AE_INFO, "not enough elements in _CST"));
                status = -EFAULT;
                goto end;
        }
@@ -675,8 +683,7 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
 
        /* Validate number of power states. */
        if (count < 1 || count != cst->package.count - 1) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "count given by _CST is not valid\n"));
+               ACPI_ERROR((AE_INFO, "count given by _CST is not valid"));
                status = -EFAULT;
                goto end;
        }
@@ -1081,7 +1088,7 @@ int acpi_processor_power_init(struct acpi_processor *pr,
                              struct acpi_device *device)
 {
        acpi_status status = 0;
-       static int first_run = 0;
+       static int first_run;
        struct proc_dir_entry *entry = NULL;
        unsigned int i;
 
@@ -1103,8 +1110,8 @@ int acpi_processor_power_init(struct acpi_processor *pr,
                status =
                    acpi_os_write_port(acpi_fadt.smi_cmd, acpi_fadt.cst_cnt, 8);
                if (ACPI_FAILURE(status)) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                         "Notifying BIOS of _CST ability failed\n"));
+                       ACPI_EXCEPTION((AE_INFO, status,
+                                       "Notifying BIOS of _CST ability failed"));
                }
        }
 
@@ -1133,9 +1140,7 @@ int acpi_processor_power_init(struct acpi_processor *pr,
        entry = create_proc_entry(ACPI_PROCESSOR_FILE_POWER,
                                  S_IRUGO, acpi_device_dir(device));
        if (!entry)
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "Unable to create '%s' fs entry\n",
-                                 ACPI_PROCESSOR_FILE_POWER));
+               return -EIO;
        else {
                entry->proc_fops = &acpi_processor_power_fops;
                entry->data = acpi_driver_data(device);