[PATCH 3/4] firmware: psci: Use register_sys_off_handler(SYS_OFF_MODE_RESTART)

From: Andrew Davis
Date: Tue Jan 23 2024 - 11:50:08 EST


Function register_restart_handler() is deprecated. Using this new API
removes our need to keep and manage a struct notifier_block.

Signed-off-by: Andrew Davis <afd@xxxxxx>
---
drivers/firmware/psci/psci.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c
index d9629ff878619..767a5af5384b4 100644
--- a/drivers/firmware/psci/psci.c
+++ b/drivers/firmware/psci/psci.c
@@ -305,8 +305,7 @@ static int get_set_conduit_method(const struct device_node *np)
return 0;
}

-static int psci_sys_reset(struct notifier_block *nb, unsigned long action,
- void *data)
+static int psci_sys_reset(struct sys_off_data *data)
{
if ((reboot_mode == REBOOT_WARM || reboot_mode == REBOOT_SOFT) &&
psci_system_reset2_supported) {
@@ -323,11 +322,6 @@ static int psci_sys_reset(struct notifier_block *nb, unsigned long action,
return NOTIFY_DONE;
}

-static struct notifier_block psci_sys_reset_nb = {
- .notifier_call = psci_sys_reset,
- .priority = 129,
-};
-
static void psci_sys_poweroff(void)
{
invoke_psci_fn(PSCI_0_2_FN_SYSTEM_OFF, 0, 0, 0);
@@ -623,7 +617,7 @@ static void __init psci_0_2_set_functions(void)
.migrate_info_type = psci_migrate_info_type,
};

- register_restart_handler(&psci_sys_reset_nb);
+ register_sys_off_handler(SYS_OFF_MODE_RESTART, 129, psci_sys_reset, NULL);

pm_power_off = psci_sys_poweroff;
}
--
2.39.2