[PATCH] um: register power-off handler
Anton Ivanov
anton.ivanov at kot-begemot.co.uk
Wed Jul 3 23:58:54 PDT 2024
On 03/07/2024 16:38, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg at intel.com>
>
> Otherwise we always get
>
> reboot: Power off not available: System halted instead
>
> which is really quite pointless.
>
> Signed-off-by: Johannes Berg <johannes.berg at intel.com>
> ---
> arch/um/kernel/reboot.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> 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);
Anton Ivanov <anton.ivanov at cambridgegreys.com>
--
Anton R. Ivanov
https://www.kot-begemot.co.uk/
More information about the linux-um
mailing list