Commit 3320648e authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Paul Walmsley

riscv: cleanup the default power off implementation

Move the sbi poweroff to a separate function and file that is only
compiled if CONFIG_SBI is set.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarAnup Patel <anup@brainfault.org>
Reviewed-by: default avatarAtish Patra <atish.patra@wdc.com>
[paul.walmsley@sifive.com: split the WFI fix into a separate patch]
Signed-off-by: default avatarPaul Walmsley <paul.walmsley@sifive.com>
parent 3b03ac6b
...@@ -41,5 +41,6 @@ obj-$(CONFIG_DYNAMIC_FTRACE) += mcount-dyn.o ...@@ -41,5 +41,6 @@ obj-$(CONFIG_DYNAMIC_FTRACE) += mcount-dyn.o
obj-$(CONFIG_PERF_EVENTS) += perf_event.o obj-$(CONFIG_PERF_EVENTS) += perf_event.o
obj-$(CONFIG_PERF_EVENTS) += perf_callchain.o obj-$(CONFIG_PERF_EVENTS) += perf_callchain.o
obj-$(CONFIG_HAVE_PERF_REGS) += perf_regs.o obj-$(CONFIG_HAVE_PERF_REGS) += perf_regs.o
obj-$(CONFIG_RISCV_SBI) += sbi.o
clean: clean:
...@@ -5,11 +5,9 @@ ...@@ -5,11 +5,9 @@
#include <linux/reboot.h> #include <linux/reboot.h>
#include <linux/pm.h> #include <linux/pm.h>
#include <asm/sbi.h>
static void default_power_off(void) static void default_power_off(void)
{ {
sbi_shutdown();
while (1) while (1)
wait_for_interrupt(); wait_for_interrupt();
} }
......
// SPDX-License-Identifier: GPL-2.0-only
#include <linux/init.h>
#include <linux/pm.h>
#include <asm/sbi.h>
static void sbi_power_off(void)
{
sbi_shutdown();
}
static int __init sbi_init(void)
{
pm_power_off = sbi_power_off;
return 0;
}
early_initcall(sbi_init);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment