Skip to content

Commit 31d8219

Browse files
gregkhsmb49
authored andcommitted
Revert "MIPS: Loongson64: reset: Prioritise firmware service"
BugLink: https://bugs.launchpad.net/bugs/2080594 This reverts commit 77011a1d7a1a973d1657d06b658ce20f94172827 which is commit 4e7ca0b upstream. Turns out to break the 5.15.y build, it should not have been backported that far. Reported-by: Guenter Roeck <linux@roeck-us.net> Cc: Jiaxun Yang <jiaxun.yang@flygoat.com> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Link: https://lore.kernel.org/r/135ef4fd-4fc9-40b4-b188-8e64946f47c4@roeck-us.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Koichiro Den <koichiro.den@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
1 parent 074ca17 commit 31d8219

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

arch/mips/loongson64/reset.c

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include <linux/init.h>
1212
#include <linux/kexec.h>
1313
#include <linux/pm.h>
14-
#include <linux/reboot.h>
1514
#include <linux/slab.h>
1615

1716
#include <asm/bootinfo.h>
@@ -22,21 +21,36 @@
2221
#include <loongson.h>
2322
#include <boot_param.h>
2423

25-
static int firmware_restart(struct sys_off_data *unusedd)
24+
static void loongson_restart(char *command)
2625
{
2726

2827
void (*fw_restart)(void) = (void *)loongson_sysconf.restart_addr;
2928

3029
fw_restart();
31-
return NOTIFY_DONE;
30+
while (1) {
31+
if (cpu_wait)
32+
cpu_wait();
33+
}
3234
}
3335

34-
static int firmware_poweroff(struct sys_off_data *unused)
36+
static void loongson_poweroff(void)
3537
{
3638
void (*fw_poweroff)(void) = (void *)loongson_sysconf.poweroff_addr;
3739

3840
fw_poweroff();
39-
return NOTIFY_DONE;
41+
while (1) {
42+
if (cpu_wait)
43+
cpu_wait();
44+
}
45+
}
46+
47+
static void loongson_halt(void)
48+
{
49+
pr_notice("\n\n** You can safely turn off the power now **\n\n");
50+
while (1) {
51+
if (cpu_wait)
52+
cpu_wait();
53+
}
4054
}
4155

4256
#ifdef CONFIG_KEXEC
@@ -140,17 +154,9 @@ static void loongson_crash_shutdown(struct pt_regs *regs)
140154

141155
static int __init mips_reboot_setup(void)
142156
{
143-
if (loongson_sysconf.restart_addr) {
144-
register_sys_off_handler(SYS_OFF_MODE_RESTART,
145-
SYS_OFF_PRIO_FIRMWARE,
146-
firmware_restart, NULL);
147-
}
148-
149-
if (loongson_sysconf.poweroff_addr) {
150-
register_sys_off_handler(SYS_OFF_MODE_POWER_OFF,
151-
SYS_OFF_PRIO_FIRMWARE,
152-
firmware_poweroff, NULL);
153-
}
157+
_machine_restart = loongson_restart;
158+
_machine_halt = loongson_halt;
159+
pm_power_off = loongson_poweroff;
154160

155161
#ifdef CONFIG_KEXEC
156162
kexec_argv = kmalloc(KEXEC_ARGV_SIZE, GFP_KERNEL);

0 commit comments

Comments
 (0)