linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] riscv: sbi: Switch to new sys-off handler API
@ 2025-08-13 15:18 Andrew Davis
  2025-08-14  9:20 ` Alexandre Ghiti
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Davis @ 2025-08-13 15:18 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti
  Cc: linux-riscv, linux-kernel, Andrew Davis

Kernel now supports chained power-off handlers. Use
register_platform_power_off() that registers a platform level power-off
handler. Legacy pm_power_off() will be removed once all drivers and archs
are converted to the new sys-off API.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 arch/riscv/kernel/sbi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/riscv/kernel/sbi.c b/arch/riscv/kernel/sbi.c
index 53836a9235e32..5e8cde0552643 100644
--- a/arch/riscv/kernel/sbi.c
+++ b/arch/riscv/kernel/sbi.c
@@ -148,7 +148,7 @@ static int __sbi_rfence_v01(int fid, const struct cpumask *cpu_mask,
 
 static void sbi_set_power_off(void)
 {
-	pm_power_off = sbi_shutdown;
+	register_platform_power_off(sbi_shutdown);
 }
 #else
 static void __sbi_set_timer_v01(uint64_t stime_value)
@@ -682,7 +682,7 @@ void __init sbi_init(void)
 		if (sbi_spec_version >= sbi_mk_version(0, 3) &&
 		    sbi_probe_extension(SBI_EXT_SRST)) {
 			pr_info("SBI SRST extension detected\n");
-			pm_power_off = sbi_srst_power_off;
+			register_platform_power_off(sbi_srst_power_off);
 			sbi_srst_reboot_nb.notifier_call = sbi_srst_reboot;
 			sbi_srst_reboot_nb.priority = 192;
 			register_restart_handler(&sbi_srst_reboot_nb);
-- 
2.39.2


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] riscv: sbi: Switch to new sys-off handler API
  2025-08-13 15:18 [PATCH] riscv: sbi: Switch to new sys-off handler API Andrew Davis
@ 2025-08-14  9:20 ` Alexandre Ghiti
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Ghiti @ 2025-08-14  9:20 UTC (permalink / raw)
  To: Andrew Davis, Paul Walmsley, Palmer Dabbelt, Albert Ou
  Cc: linux-riscv, linux-kernel

Hi Andrew,

On 8/13/25 17:18, Andrew Davis wrote:
> Kernel now supports chained power-off handlers. Use
> register_platform_power_off() that registers a platform level power-off
> handler. Legacy pm_power_off() will be removed once all drivers and archs
> are converted to the new sys-off API.
>
> Signed-off-by: Andrew Davis <afd@ti.com>
> ---
>   arch/riscv/kernel/sbi.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/riscv/kernel/sbi.c b/arch/riscv/kernel/sbi.c
> index 53836a9235e32..5e8cde0552643 100644
> --- a/arch/riscv/kernel/sbi.c
> +++ b/arch/riscv/kernel/sbi.c
> @@ -148,7 +148,7 @@ static int __sbi_rfence_v01(int fid, const struct cpumask *cpu_mask,
>   
>   static void sbi_set_power_off(void)
>   {
> -	pm_power_off = sbi_shutdown;
> +	register_platform_power_off(sbi_shutdown);
>   }
>   #else
>   static void __sbi_set_timer_v01(uint64_t stime_value)
> @@ -682,7 +682,7 @@ void __init sbi_init(void)
>   		if (sbi_spec_version >= sbi_mk_version(0, 3) &&
>   		    sbi_probe_extension(SBI_EXT_SRST)) {
>   			pr_info("SBI SRST extension detected\n");
> -			pm_power_off = sbi_srst_power_off;
> +			register_platform_power_off(sbi_srst_power_off);
>   			sbi_srst_reboot_nb.notifier_call = sbi_srst_reboot;
>   			sbi_srst_reboot_nb.priority = 192;
>   			register_restart_handler(&sbi_srst_reboot_nb);


Tested-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>

I'll take that for 6.18.

Thanks,

Alex


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-08-14 13:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-13 15:18 [PATCH] riscv: sbi: Switch to new sys-off handler API Andrew Davis
2025-08-14  9:20 ` Alexandre Ghiti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).