diff options
author | Christoph Hellwig <hch@lst.de> | 2019-10-28 13:10:35 +0100 |
---|---|---|
committer | Paul Walmsley <paul.walmsley@sifive.com> | 2019-11-13 22:22:52 +0100 |
commit | 3320648ecc38190caad298fbbce949f591a10253 (patch) | |
tree | 88549192676c8811bc263a32a88c9184597ad003 /arch/riscv/kernel/sbi.c | |
parent | riscv: poison SBI calls for M-mode (diff) | |
download | linux-3320648ecc38190caad298fbbce949f591a10253.tar.xz linux-3320648ecc38190caad298fbbce949f591a10253.zip |
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.c | 17 |
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); |