summaryrefslogtreecommitdiff
path: root/arch/riscv/kernel/sbi.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2019-10-28 13:10:35 +0100
committerPaul Walmsley <paul.walmsley@sifive.com>2019-11-13 13:22:52 -0800
commit3320648ecc38190caad298fbbce949f591a10253 (patch)
tree88549192676c8811bc263a32a88c9184597ad003 /arch/riscv/kernel/sbi.c
parent3b03ac6bbd6ef6264d533791ac448e20bfb1858d (diff)
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: Christoph Hellwig <hch@lst.de> Reviewed-by: Anup Patel <anup@brainfault.org> Reviewed-by: Atish Patra <atish.patra@wdc.com> [paul.walmsley@sifive.com: split the WFI fix into a separate patch] Signed-off-by: Paul Walmsley <paul.walmsley@sifive.com>
Diffstat (limited to 'arch/riscv/kernel/sbi.c')
-rw-r--r--arch/riscv/kernel/sbi.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/arch/riscv/kernel/sbi.c b/arch/riscv/kernel/sbi.c
new file mode 100644
index 000000000000..f6c7c3e82d28
--- /dev/null
+++ b/arch/riscv/kernel/sbi.c
@@ -0,0 +1,17 @@
+// 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);