hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/arch/riscv/kernel/reset.c
....@@ -1,21 +1,18 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 2012 Regents of the University of California
3
- *
4
- * This program is free software; you can redistribute it and/or
5
- * modify it under the terms of the GNU General Public License
6
- * as published by the Free Software Foundation, version 2.
7
- *
8
- * This program is distributed in the hope that it will be useful,
9
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- * GNU General Public License for more details.
124 */
135
146 #include <linux/reboot.h>
15
-#include <linux/export.h>
16
-#include <asm/sbi.h>
7
+#include <linux/pm.h>
178
18
-void (*pm_power_off)(void) = machine_power_off;
9
+static void default_power_off(void)
10
+{
11
+ while (1)
12
+ wait_for_interrupt();
13
+}
14
+
15
+void (*pm_power_off)(void) = NULL;
1916 EXPORT_SYMBOL(pm_power_off);
2017
2118 void machine_restart(char *cmd)
....@@ -26,11 +23,16 @@
2623
2724 void machine_halt(void)
2825 {
29
- machine_power_off();
26
+ if (pm_power_off != NULL)
27
+ pm_power_off();
28
+ else
29
+ default_power_off();
3030 }
3131
3232 void machine_power_off(void)
3333 {
34
- sbi_shutdown();
35
- while (1);
34
+ if (pm_power_off != NULL)
35
+ pm_power_off();
36
+ else
37
+ default_power_off();
3638 }