diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2022-05-25 14:38:29 +0200 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2022-05-25 14:38:29 +0200 |
commit | 14c03a4a757f4be3e81c5004ca72f809ab04e0b1 (patch) | |
tree | bd2586eb8dab7e979aef0cf378037877521395ea /drivers/acpi | |
parent | 09583dfed2cb9723da31601cb7080490c2e2e2d7 (diff) | |
parent | 6779db970bd287bb35b28bd5dc256fd7aef19d1c (diff) | |
download | lwn-14c03a4a757f4be3e81c5004ca72f809ab04e0b1.tar.gz lwn-14c03a4a757f4be3e81c5004ca72f809ab04e0b1.zip |
Merge back reboot/poweroff notifiers rework for 5.19-rc1.
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/sleep.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 3147702710af..04ea1569df78 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c @@ -1035,20 +1035,22 @@ static void acpi_sleep_hibernate_setup(void) static inline void acpi_sleep_hibernate_setup(void) {} #endif /* !CONFIG_HIBERNATION */ -static void acpi_power_off_prepare(void) +static int acpi_power_off_prepare(struct sys_off_data *data) { /* Prepare to power off the system */ acpi_sleep_prepare(ACPI_STATE_S5); acpi_disable_all_gpes(); acpi_os_wait_events_complete(); + return NOTIFY_DONE; } -static void acpi_power_off(void) +static int acpi_power_off(struct sys_off_data *data) { /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */ pr_debug("%s called\n", __func__); local_irq_disable(); acpi_enter_sleep_state(ACPI_STATE_S5); + return NOTIFY_DONE; } int __init acpi_sleep_init(void) @@ -1067,8 +1069,14 @@ int __init acpi_sleep_init(void) if (acpi_sleep_state_supported(ACPI_STATE_S5)) { sleep_states[ACPI_STATE_S5] = 1; - pm_power_off_prepare = acpi_power_off_prepare; - pm_power_off = acpi_power_off; + + register_sys_off_handler(SYS_OFF_MODE_POWER_OFF_PREPARE, + SYS_OFF_PRIO_FIRMWARE, + acpi_power_off_prepare, NULL); + + register_sys_off_handler(SYS_OFF_MODE_POWER_OFF, + SYS_OFF_PRIO_FIRMWARE, + acpi_power_off, NULL); } else { acpi_no_s5 = true; } |