Skip to content

Commit

Permalink
ACPI / sleep: pm_power_off needs more sanity checks to be installed
Browse files Browse the repository at this point in the history
Sleep control and status registers need santity checks as well before
ACPI installs acpi_power_off to pm_power_off hook. The checking code in
acpi_enter_sleep_state() is too late, we should not allow a not-working
pm_power_off function to be hooked up.

Signed-off-by: Aubrey Li <aubrey.li@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Li, Aubrey authored and Rafael J. Wysocki committed Mar 2, 2014
1 parent cfbf8d4 commit 3130497
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/acpi/sleep.c
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,12 @@ int __init acpi_sleep_init(void)
acpi_sleep_hibernate_setup();

status = acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b);
if (ACPI_SUCCESS(status)) {
/*
* Check both ACPI S5 object and ACPI sleep registers to
* install pm_power_off_prepare/pm_power_off hook
*/
if (ACPI_SUCCESS(status) && acpi_gbl_FADT.sleep_control.address
&& acpi_gbl_FADT.sleep_status.address) {
sleep_states[ACPI_STATE_S5] = 1;
pm_power_off_prepare = acpi_power_off_prepare;
pm_power_off = acpi_power_off;
Expand Down

0 comments on commit 3130497

Please sign in to comment.