]> git.baikalelectronics.ru Git - kernel.git/commit
riscv: set default pm_power_off to NULL
authorDimitri John Ledkov <dimitri.ledkov@canonical.com>
Tue, 7 Sep 2021 00:28:47 +0000 (01:28 +0100)
committerPalmer Dabbelt <palmerdabbelt@google.com>
Mon, 4 Oct 2021 21:16:57 +0000 (14:16 -0700)
commite993e4891ec336059baf4f9716f88b2921912728
tree20fc49d7497aba307ed4d0508226eb9c465fdc82
parent32f4124394a50343e3f2642df1df5f515a8cc876
riscv: set default pm_power_off to NULL

Set pm_power_off to NULL like on all other architectures, check if it
is set in machine_halt() and machine_power_off() and fallback to
default_power_off if no other power driver got registered.

This brings riscv architecture inline with all other architectures,
and allows to reuse exiting power drivers unmodified.

Kernels without legacy SBI v0.1 extensions (CONFIG_RISCV_SBI_V01 is
not set), do not set pm_power_off to sbi_shutdown(). There is no
support for SBI v0.3 system reset extension either. This prevents
using gpio_poweroff on SiFive HiFive Unmatched.

Tested on SiFive HiFive unmatched, with a dtb specifying gpio-poweroff
node and kernel complied without CONFIG_RISCV_SBI_V01.

BugLink: https://bugs.launchpad.net/bugs/1942806
Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Tested-by: Ron Economos <w6rz@comcast.net>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
arch/riscv/kernel/reset.c