public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Guenter Roeck <linux@roeck-us.net>
Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
	Len Brown <len.brown@intel.com>, Pavel Machek <pavel@ucw.cz>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [RFC PATCH 1/2] acpi: Use syscore instead of pm_power_off_prepare to prepare for poweroff
Date: Sun, 12 Oct 2014 21:45:31 +0200	[thread overview]
Message-ID: <3090667.ydmQKSGePB@vostro.rjw.lan> (raw)
In-Reply-To: <1413062057-11657-2-git-send-email-linux@roeck-us.net>

On Saturday, October 11, 2014 02:14:16 PM Guenter Roeck wrote:
> The syscore shutdown callback seems to be perfectly suited to prepare for system
> poweroff. Use it instead of pm_power_off_prepare.

How much testing did that receive?

> Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
> Cc: Len Brown <len.brown@intel.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
>  drivers/acpi/sleep.c | 21 ++++++++++++++++-----
>  1 file changed, 16 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
> index 05a31b5..e03c74d 100644
> --- a/drivers/acpi/sleep.c
> +++ b/drivers/acpi/sleep.c
> @@ -17,6 +17,7 @@
>  #include <linux/interrupt.h>
>  #include <linux/suspend.h>
>  #include <linux/reboot.h>
> +#include <linux/syscore_ops.h>
>  #include <linux/acpi.h>
>  #include <linux/module.h>
>  #include <asm/io.h>
> @@ -820,13 +821,23 @@ int acpi_suspend(u32 acpi_state)
>  	return -EINVAL;
>  }
>  
> -static void acpi_power_off_prepare(void)
> +static void acpi_shutdown(void)
>  {
> -	/* Prepare to power off the system */
> -	acpi_sleep_prepare(ACPI_STATE_S5);
> -	acpi_disable_all_gpes();
> +	switch (system_state) {
> +	case SYSTEM_POWER_OFF:
> +		/* Prepare to power off the system */
> +		acpi_sleep_prepare(ACPI_STATE_S5);
> +		acpi_disable_all_gpes();
> +		break;
> +	default:
> +		break;
> +	}
>  }
>  
> +static struct syscore_ops acpi_syscore_ops = {
> +	.shutdown = acpi_shutdown,
> +};
> +
>  static void acpi_power_off(void)
>  {
>  	/* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */
> @@ -850,7 +861,7 @@ int __init acpi_sleep_init(void)
>  
>  	if (acpi_sleep_state_supported(ACPI_STATE_S5)) {
>  		sleep_states[ACPI_STATE_S5] = 1;
> -		pm_power_off_prepare = acpi_power_off_prepare;
> +		register_syscore_ops(&acpi_syscore_ops);
>  		pm_power_off = acpi_power_off;
>  	}
>  
> 

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

  reply	other threads:[~2014-10-12 19:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-11 21:14 [RFC PATCH 0/2] kernel: Drop pm_poweroff_prepare Guenter Roeck
2014-10-11 21:14 ` [RFC PATCH 1/2] acpi: Use syscore instead of pm_power_off_prepare to prepare for poweroff Guenter Roeck
2014-10-12 19:45   ` Rafael J. Wysocki [this message]
2014-10-12 19:35     ` Guenter Roeck
2014-10-12 20:16       ` Rafael J. Wysocki
2014-10-12 19:59         ` Guenter Roeck
2014-10-11 21:14 ` [RFC PATCH 2/2] kernel: power: Drop pm_poweroff_prepare Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3090667.ydmQKSGePB@vostro.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=akpm@linux-foundation.org \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=pavel@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox