]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
um: register power-off handler
authorJohannes Berg <johannes.berg@intel.com>
Wed, 3 Jul 2024 15:38:40 +0000 (17:38 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 4 Jul 2024 10:03:20 +0000 (12:03 +0200)
Otherwise we always get

 reboot: Power off not available: System halted instead

which is really quite pointless.

Link: https://patch.msgid.link/20240703173839.fcbb538c6686.I3d333f4773cff93c4337c4d128ee0b1b501b3dfa@changeid
Acked-By: Anton Ivanov <anton.ivanov@cambridgegreys.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
arch/um/kernel/reboot.c

index 25840eee1068c3588852303bd07e9fdd9a42e3c9..3736bca626ba0b59a862c2634b81d2624a1bde99 100644 (file)
@@ -59,3 +59,18 @@ void machine_halt(void)
 {
        machine_power_off();
 }
+
+static int sys_power_off_handler(struct sys_off_data *data)
+{
+       machine_power_off();
+       return 0;
+}
+
+static int register_power_off(void)
+{
+       register_sys_off_handler(SYS_OFF_MODE_POWER_OFF,
+                                SYS_OFF_PRIO_DEFAULT,
+                                sys_power_off_handler, NULL);
+       return 0;
+}
+__initcall(register_power_off);