Subject: [Xen-devel] [RFC PATCH 14/16] x86/xen: support poweroff through poweroff handler call chain

From: [email-masked] (David Vrabel)
Date: Thu, 2 Oct 2014 10:45:40 +0100

On 30/09/14 19:00, Guenter Roeck wrote:
> The kernel core now supports a poweroff handler call chain
> to remove power from the system. Call it if pm_power_off
> is set to NULL.
> 
> Cc: Konrad Rzeszutek Wilk <[email-masked]>
> Cc: Boris Ostrovsky <[email-masked]>
> Cc: Thomas Gleixner <[email-masked]>
> Cc: Ingo Molnar <[email-masked]>
> Cc: H. Peter Anvin <[email-masked]>
> Signed-off-by: Guenter Roeck <[email-masked]>
> ---
>  arch/x86/xen/enlighten.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
> index c0cb11f..645d00f 100644
> --- a/arch/x86/xen/enlighten.c
> +++ b/arch/x86/xen/enlighten.c
> @@ -1322,6 +1322,8 @@ static void xen_machine_power_off(void)
>  {
>  	if (pm_power_off)
>  		pm_power_off();
> +	else
> +		do_kernel_poweroff();

Why isn't this if (pm_power_off) check in do_kernel_poweroff()?

That way when you finally remove pm_power_off you need only update one
place.  A quick skim of the other archs suggest this would work for them
too.

David