1
0
Fork 0

riscv: call pm_power_off from machine_halt / machine_power_off

This way any override of pm_power_off also affects the halt path and
we don't need additional infrastructure for it.

Also remove the pm_power_off export - at least for now we don't have
any modular drivers overriding it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Atish Patra <atish.patra@wdc.com>
Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
hifive-unleashed-5.2
Christoph Hellwig 2019-04-15 11:14:42 +02:00 committed by Palmer Dabbelt
parent bed1378706
commit bf0102a0fd
No known key found for this signature in database
GPG Key ID: EF4CA1502CCBAB41
1 changed files with 9 additions and 6 deletions

View File

@ -12,11 +12,15 @@
*/
#include <linux/reboot.h>
#include <linux/export.h>
#include <asm/sbi.h>
void (*pm_power_off)(void) = machine_power_off;
EXPORT_SYMBOL(pm_power_off);
static void default_power_off(void)
{
sbi_shutdown();
while (1);
}
void (*pm_power_off)(void) = default_power_off;
void machine_restart(char *cmd)
{
@ -26,11 +30,10 @@ void machine_restart(char *cmd)
void machine_halt(void)
{
machine_power_off();
pm_power_off();
}
void machine_power_off(void)
{
sbi_shutdown();
while (1);
pm_power_off();
}