diff mbox series

parisc: Allow to reboot machine after system halt

Message ID 20230522205730.309803-1-deller@gmx.de (mailing list archive)
State Accepted, archived
Headers show
Series parisc: Allow to reboot machine after system halt | expand

Commit Message

Helge Deller May 22, 2023, 8:57 p.m. UTC
In case a machine can't power-off itself on system shutdown,
allow the user to reboot it by pressing the RETURN key.

Signed-off-by: Helge Deller <deller@gmx.de>
---
 arch/parisc/kernel/process.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

--
2.38.1
diff mbox series

Patch

diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
index c064719b49b0..ec48850b9273 100644
--- a/arch/parisc/kernel/process.c
+++ b/arch/parisc/kernel/process.c
@@ -122,13 +122,18 @@  void machine_power_off(void)
 	/* It seems we have no way to power the system off via
 	 * software. The user has to press the button himself. */

-	printk(KERN_EMERG "System shut down completed.\n"
-	       "Please power this system off now.");
+	printk("Power off or press RETURN to reboot.\n");

 	/* prevent soft lockup/stalled CPU messages for endless loop. */
 	rcu_sysrq_start();
 	lockup_detector_soft_poweroff();
-	for (;;);
+	while (1) {
+		/* reboot if user presses RETURN key */
+		if (pdc_iodc_getc() == 13) {
+			printk("Rebooting...\n");
+			machine_restart(NULL);
+		}
+	}
 }

 void (*pm_power_off)(void);