2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-23 20:53:53 +08:00

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>
This commit is contained in:
Christoph Hellwig 2019-10-28 13:10:35 +01:00 committed by Paul Walmsley
parent 3b03ac6bbd
commit 3320648ecc
3 changed files with 18 additions and 2 deletions

View File

@ -41,5 +41,6 @@ obj-$(CONFIG_DYNAMIC_FTRACE) += mcount-dyn.o
obj-$(CONFIG_PERF_EVENTS) += perf_event.o
obj-$(CONFIG_PERF_EVENTS) += perf_callchain.o
obj-$(CONFIG_HAVE_PERF_REGS) += perf_regs.o
obj-$(CONFIG_RISCV_SBI) += sbi.o
clean:

View File

@ -5,11 +5,9 @@
#include <linux/reboot.h>
#include <linux/pm.h>
#include <asm/sbi.h>
static void default_power_off(void)
{
sbi_shutdown();
while (1)
wait_for_interrupt();
}

17
arch/riscv/kernel/sbi.c Normal file
View File

@ -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);