]> err.no Git - linux-2.6/blobdiff - drivers/acpi/bus.c
Pull bugzilla-9494 into release branch
[linux-2.6] / drivers / acpi / bus.c
index a54234d3aac12d7f3c59af3f027cf80196d73e0a..d7a115c362d1b53c84a61164c51ff24036684b28 100644 (file)
@@ -29,7 +29,6 @@
 #include <linux/list.h>
 #include <linux/sched.h>
 #include <linux/pm.h>
-#include <linux/pm_legacy.h>
 #include <linux/device.h>
 #include <linux/proc_fs.h>
 #ifdef CONFIG_X86
@@ -194,16 +193,14 @@ int acpi_bus_set_power(acpi_handle handle, int state)
 
        if (!device->flags.power_manageable) {
                ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device `[%s]' is not power manageable\n",
-                               device->dev.kobj.name));
+                               kobject_name(&device->dev.kobj)));
                return -ENODEV;
        }
        /*
-        * Get device's current power state if it's unknown
-        * This means device power state isn't initialized or previous setting failed
+        * Get device's current power state
         */
-       if ((device->power.state == ACPI_STATE_UNKNOWN) || device->flags.force_power_state)
-               acpi_bus_get_power(device->handle, &device->power.state);
-       if ((state == device->power.state) && !device->flags.force_power_state) {
+       acpi_bus_get_power(device->handle, &device->power.state);
+       if (state == device->power.state) {
                ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n",
                                  state));
                return 0;
@@ -262,10 +259,12 @@ int acpi_bus_set_power(acpi_handle handle, int state)
                printk(KERN_WARNING PREFIX
                              "Transitioning device [%s] to D%d\n",
                              device->pnp.bus_id, state);
-       else
+       else {
+               device->power.state = state;
                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
                                  "Device [%s] transitioned to D%d\n",
                                  device->pnp.bus_id, state));
+       }
 
        return result;
 }
@@ -764,16 +763,14 @@ static int __init acpi_init(void)
        result = acpi_bus_init();
 
        if (!result) {
-#ifdef CONFIG_PM_LEGACY
-               if (!PM_IS_ACTIVE())
-                       pm_active = 1;
+               if (!(pm_flags & PM_APM))
+                       pm_flags |= PM_ACPI;
                else {
                        printk(KERN_INFO PREFIX
                               "APM is already active, exiting\n");
                        disable_acpi();
                        result = -ENODEV;
                }
-#endif
        } else
                disable_acpi();