summaryrefslogtreecommitdiff
path: root/arch/um
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2024-07-03 18:38:40 +0300
committerJohannes Berg <johannes.berg@intel.com>2024-07-04 13:03:20 +0300
commit86abcd6eeb56e49311aea2f4695af0b3b5eaeb26 (patch)
tree207516673431611e05f90c515fa08f66c0850ea5 /arch/um
parent824ac4a5edd3f7494ab1996826c4f47f8ef0f63d (diff)
downloadlinux-86abcd6eeb56e49311aea2f4695af0b3b5eaeb26.tar.xz
um: register power-off handler
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>
Diffstat (limited to 'arch/um')
-rw-r--r--arch/um/kernel/reboot.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/arch/um/kernel/reboot.c b/arch/um/kernel/reboot.c
index 25840eee1068..3736bca626ba 100644
--- a/arch/um/kernel/reboot.c
+++ b/arch/um/kernel/reboot.c
@@ -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);