diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-06-16 00:37:59 +0200 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-06-19 23:37:08 +0200 |
commit | fa1675b56537651270e79967b7f1ee4202c83bf6 (patch) | |
tree | 0c294f009d636378d79fd8300bb5c936ffdb656f /include/acpi | |
parent | 4c164ae7d8a7ee1f39b773d97794535c2c193b12 (diff) |
ACPI / PM: Rework and clean up acpi_dev_pm_get_state()
The acpi_dev_pm_get_state() function defined in device_pm.c is quite
convoluted, which isn't really necessary, and it doesn't validate the
values returned by the ACPI methods executed by it appropriately.
To address these shortcomings modify it in the following way.
(1) Make its return value only mean whether or not it succeeded and
pass the device power states determined by it through pointers.
(2) Drop the d_max_in argument, used by only one of its callers,
from it, and move the code related to d_max_in into that caller,
acpi_pm_device_sleep_state().
(3) Make it always check the return value of acpi_evaluate_integer()
and handle failures as appropriate. Moreover, make it check if
the values returned by the executed ACPI methods are not out of
range.
(4) Make it check if the values returned by the executed ACPI
methods represent valid power states of the given device and
handle situations in which that's not the case gracefully.
Also update the kerneldoc comments of acpi_dev_pm_get_state() and
acpi_pm_device_sleep_state() to reflect the code changes.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'include/acpi')
0 files changed, 0 insertions, 0 deletions