]> nv-tegra.nvidia Code Review - linux-2.6.git/commitdiff
Pull bugzilla-7570 into release branch
authorLen Brown <len.brown@intel.com>
Sat, 10 Mar 2007 04:18:46 +0000 (23:18 -0500)
committerLen Brown <len.brown@intel.com>
Sat, 10 Mar 2007 04:18:46 +0000 (23:18 -0500)
drivers/acpi/power.c

index 1ef338545dfef977034a490d56ae9c5f043eb948..547eee7537bcfbdaaef321f567c8bb5c9a564e4b 100644 (file)
@@ -436,8 +436,6 @@ int acpi_power_transition(struct acpi_device *device, int state)
        cl = &device->power.states[device->power.state].resources;
        tl = &device->power.states[state].resources;
 
-       device->power.state = ACPI_STATE_UNKNOWN;
-
        if (!cl->count && !tl->count) {
                result = -ENODEV;
                goto end;
@@ -468,12 +466,15 @@ int acpi_power_transition(struct acpi_device *device, int state)
                        goto end;
        }
 
-       /* We shouldn't change the state till all above operations succeed */
-       device->power.state = state;
-      end:
-       if (result)
+     end:
+       if (result) {
+               device->power.state = ACPI_STATE_UNKNOWN;
                printk(KERN_WARNING PREFIX "Transitioning device [%s] to D%d\n",
                              device->pnp.bus_id, state);
+       } else {
+       /* We shouldn't change the state till all above operations succeed */
+               device->power.state = state;
+       }
 
        return result;
 }