diff mbox series

[1/4] firmware: psci: switch SYSTEM_OFF to sys-off handler API

Message ID 20260514-smaug-poweroff-v1-1-30f9a4688966@tecnico.ulisboa.pt
State Handled Elsewhere
Headers show
Series power: sys-off: fix Pixel C shutdown via MAX77620 | expand

Commit Message

Diogo Ivo May 14, 2026, 2:47 p.m. UTC
Replace the legacy pm_power_off hook with the generic sys-off
handler infrastructure.

Convert psci_sys_poweroff() to the sys-off callback prototype and
register it through register_sys_off_handler() with firmware
priority. This removes the direct dependency on pm_power_off and
drops the now-unused <linux/pm.h> include.

This aligns the PSCI poweroff path with the modern system-off
framework used by other firmware and platform drivers.

Signed-off-by: Diogo Ivo <diogo.ivo@tecnico.ulisboa.pt>
---
 drivers/firmware/psci/psci.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Thierry Reding May 28, 2026, 8:54 p.m. UTC | #1
On Thu, May 14, 2026 at 04:47:19PM +0200, Diogo Ivo wrote:
> Replace the legacy pm_power_off hook with the generic sys-off
> handler infrastructure.
> 
> Convert psci_sys_poweroff() to the sys-off callback prototype and
> register it through register_sys_off_handler() with firmware
> priority. This removes the direct dependency on pm_power_off and
> drops the now-unused <linux/pm.h> include.
> 
> This aligns the PSCI poweroff path with the modern system-off
> framework used by other firmware and platform drivers.
> 
> Signed-off-by: Diogo Ivo <diogo.ivo@tecnico.ulisboa.pt>
> ---
>  drivers/firmware/psci/psci.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)

Reviewed-by: Thierry Reding <treding@nvidia.com>
diff mbox series

Patch

diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c
index 38ca190d4a22..d6e9721d11e5 100644
--- a/drivers/firmware/psci/psci.c
+++ b/drivers/firmware/psci/psci.c
@@ -13,7 +13,6 @@ 
 #include <linux/errno.h>
 #include <linux/linkage.h>
 #include <linux/of.h>
-#include <linux/pm.h>
 #include <linux/printk.h>
 #include <linux/psci.h>
 #include <linux/reboot.h>
@@ -329,9 +328,11 @@  static struct notifier_block psci_sys_reset_nb = {
 	.priority = 129,
 };
 
-static void psci_sys_poweroff(void)
+static int psci_sys_poweroff(struct sys_off_data *data)
 {
 	invoke_psci_fn(PSCI_0_2_FN_SYSTEM_OFF, 0, 0, 0);
+
+	return NOTIFY_DONE;
 }
 
 #ifdef CONFIG_HIBERNATION
@@ -671,7 +672,8 @@  static void __init psci_0_2_set_functions(void)
 
 	register_restart_handler(&psci_sys_reset_nb);
 
-	pm_power_off = psci_sys_poweroff;
+	register_sys_off_handler(SYS_OFF_MODE_POWER_OFF, SYS_OFF_PRIO_FIRMWARE,
+				 psci_sys_poweroff, NULL);
 }
 
 /*