patch-2.4.23 linux-2.4.23/drivers/acpi/power.c
Next file: linux-2.4.23/drivers/acpi/resources/rsaddr.c
Previous file: linux-2.4.23/drivers/acpi/pci_root.c
Back to the patch index
Back to the overall index
- Lines: 28
- Date:
2003-11-28 10:26:19.000000000 -0800
- Orig file:
linux-2.4.22/drivers/acpi/power.c
- Orig date:
2003-08-25 04:44:41.000000000 -0700
diff -urN linux-2.4.22/drivers/acpi/power.c linux-2.4.23/drivers/acpi/power.c
@@ -323,6 +323,9 @@
if (!device || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3))
return_VALUE(-EINVAL);
+ if ((device->power.state < ACPI_STATE_D0) || (device->power.state > ACPI_STATE_D3))
+ return_VALUE(-ENODEV);
+
cl = &device->power.states[device->power.state].resources;
tl = &device->power.states[state].resources;
@@ -345,8 +348,6 @@
goto end;
}
- device->power.state = state;
-
/*
* Then we dereference all power resources used in the current list.
*/
@@ -356,6 +357,8 @@
goto end;
}
+ /* We shouldn't change the state till all above operations succeed */
+ device->power.state = state;
end:
if (result)
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)