Commit 3130497f authored by Li, Aubrey's avatar Li, Aubrey Committed by Rafael J. Wysocki

ACPI / sleep: pm_power_off needs more sanity checks to be installed

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: default avatarAubrey Li <aubrey.li@intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent cfbf8d48
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment