Skip to content

Commit 98f30d0

Browse files
digetxrafaeljw
authored andcommitted
ACPI: power: Switch to sys-off handler API
Switch to sys-off API that replaces legacy pm_power_off callbacks, allowing us to remove global pm_* variables and support chaining of all restart and power-off modes consistently. Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent bf8d73b commit 98f30d0

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

drivers/acpi/sleep.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,20 +1023,22 @@ static void acpi_sleep_hibernate_setup(void)
10231023
static inline void acpi_sleep_hibernate_setup(void) {}
10241024
#endif /* !CONFIG_HIBERNATION */
10251025

1026-
static void acpi_power_off_prepare(void)
1026+
static int acpi_power_off_prepare(struct sys_off_data *data)
10271027
{
10281028
/* Prepare to power off the system */
10291029
acpi_sleep_prepare(ACPI_STATE_S5);
10301030
acpi_disable_all_gpes();
10311031
acpi_os_wait_events_complete();
1032+
return NOTIFY_DONE;
10321033
}
10331034

1034-
static void acpi_power_off(void)
1035+
static int acpi_power_off(struct sys_off_data *data)
10351036
{
10361037
/* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */
10371038
pr_debug("%s called\n", __func__);
10381039
local_irq_disable();
10391040
acpi_enter_sleep_state(ACPI_STATE_S5);
1041+
return NOTIFY_DONE;
10401042
}
10411043

10421044
int __init acpi_sleep_init(void)
@@ -1055,8 +1057,14 @@ int __init acpi_sleep_init(void)
10551057

10561058
if (acpi_sleep_state_supported(ACPI_STATE_S5)) {
10571059
sleep_states[ACPI_STATE_S5] = 1;
1058-
pm_power_off_prepare = acpi_power_off_prepare;
1059-
pm_power_off = acpi_power_off;
1060+
1061+
register_sys_off_handler(SYS_OFF_MODE_POWER_OFF_PREPARE,
1062+
SYS_OFF_PRIO_FIRMWARE,
1063+
acpi_power_off_prepare, NULL);
1064+
1065+
register_sys_off_handler(SYS_OFF_MODE_POWER_OFF,
1066+
SYS_OFF_PRIO_FIRMWARE,
1067+
acpi_power_off, NULL);
10601068
} else {
10611069
acpi_no_s5 = true;
10621070
}

0 commit comments

Comments
 (0)