]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/acpi/processor_idle.c
asus-laptop: add display switching support
[linux-2.6-omap-h63xx.git] / drivers / acpi / processor_idle.c
index 429a39dbd75d19475583da403bc18450b29b5ea7..3f30af21574ea37c3d443f54e2050fa4fb85c77f 100644 (file)
@@ -211,7 +211,11 @@ acpi_processor_power_activate(struct acpi_processor *pr,
 static void acpi_safe_halt(void)
 {
        current_thread_info()->status &= ~TS_POLLING;
-       smp_mb__after_clear_bit();
+       /*
+        * TS_POLLING-cleared state must be visible before we
+        * test NEED_RESCHED:
+        */
+       smp_mb();
        if (!need_resched())
                safe_halt();
        current_thread_info()->status |= TS_POLLING;
@@ -345,7 +349,11 @@ static void acpi_processor_idle(void)
         */
        if (cx->type == ACPI_STATE_C2 || cx->type == ACPI_STATE_C3) {
                current_thread_info()->status &= ~TS_POLLING;
-               smp_mb__after_clear_bit();
+               /*
+                * TS_POLLING-cleared state must be visible before we
+                * test NEED_RESCHED:
+                */
+               smp_mb();
                if (need_resched()) {
                        current_thread_info()->status |= TS_POLLING;
                        local_irq_enable();
@@ -673,7 +681,7 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
                return -ENODEV;
        }
 
-       cst = (union acpi_object *)buffer.pointer;
+       cst = buffer.pointer;
 
        /* There must be at least 2 elements */
        if (!cst || (cst->type != ACPI_TYPE_PACKAGE) || cst->package.count < 2) {
@@ -702,14 +710,14 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
 
                memset(&cx, 0, sizeof(cx));
 
-               element = (union acpi_object *)&(cst->package.elements[i]);
+               element = &(cst->package.elements[i]);
                if (element->type != ACPI_TYPE_PACKAGE)
                        continue;
 
                if (element->package.count != 4)
                        continue;
 
-               obj = (union acpi_object *)&(element->package.elements[0]);
+               obj = &(element->package.elements[0]);
 
                if (obj->type != ACPI_TYPE_BUFFER)
                        continue;
@@ -721,7 +729,7 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
                        continue;
 
                /* There should be an easy way to extract an integer... */
-               obj = (union acpi_object *)&(element->package.elements[1]);
+               obj = &(element->package.elements[1]);
                if (obj->type != ACPI_TYPE_INTEGER)
                        continue;
 
@@ -754,13 +762,13 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
                        }
                }
 
-               obj = (union acpi_object *)&(element->package.elements[2]);
+               obj = &(element->package.elements[2]);
                if (obj->type != ACPI_TYPE_INTEGER)
                        continue;
 
                cx.latency = obj->integer.value;
 
-               obj = (union acpi_object *)&(element->package.elements[3]);
+               obj = &(element->package.elements[3]);
                if (obj->type != ACPI_TYPE_INTEGER)
                        continue;
 
@@ -962,7 +970,7 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr)
 
        result = acpi_processor_get_power_info_cst(pr);
        if (result == -ENODEV)
-               acpi_processor_get_power_info_fadt(pr);
+               result = acpi_processor_get_power_info_fadt(pr);
 
        if (result)
                return result;
@@ -1029,7 +1037,7 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr)
 
 static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset)
 {
-       struct acpi_processor *pr = (struct acpi_processor *)seq->private;
+       struct acpi_processor *pr = seq->private;
        unsigned int i;
 
 
@@ -1108,6 +1116,7 @@ static const struct file_operations acpi_processor_power_fops = {
        .release = single_release,
 };
 
+#ifdef CONFIG_SMP
 static void smp_callback(void *v)
 {
        /* we already woke the CPU up, nothing more to do */
@@ -1129,8 +1138,9 @@ static int acpi_processor_latency_notify(struct notifier_block *b,
 static struct notifier_block acpi_processor_latency_notifier = {
        .notifier_call = acpi_processor_latency_notify,
 };
+#endif
 
-int acpi_processor_power_init(struct acpi_processor *pr,
+int __cpuinit acpi_processor_power_init(struct acpi_processor *pr,
                              struct acpi_device *device)
 {
        acpi_status status = 0;
@@ -1146,7 +1156,9 @@ int acpi_processor_power_init(struct acpi_processor *pr,
                               "ACPI: processor limited to max C-state %d\n",
                               max_cstate);
                first_run++;
+#ifdef CONFIG_SMP
                register_latency_notifier(&acpi_processor_latency_notifier);
+#endif
        }
 
        if (!pr)
@@ -1218,7 +1230,9 @@ int acpi_processor_power_exit(struct acpi_processor *pr,
                 * copies of pm_idle before proceeding.
                 */
                cpu_idle_wait();
+#ifdef CONFIG_SMP
                unregister_latency_notifier(&acpi_processor_latency_notifier);
+#endif
        }
 
        return 0;