linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Jeff Garzik <jeff@garzik.org>, Frans Pop <elendil@planet.nl>,
	tj@kernel.org, akpm@linux-foundation.org,
	torvalds@linux-foundation.org, linux-ide@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/6] Hibernation: Introduce system_entering_hibernation
Date: Mon, 19 Jan 2009 22:25:20 +0100	[thread overview]
Message-ID: <20090119212428.GB6194@nowhere> (raw)
In-Reply-To: <200901192054.55536.rjw@sisk.pl>

On Mon, Jan 19, 2009 at 08:54:54PM +0100, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rjw@sisk.pl>
> 
> Introduce boolean function system_entering_hibernation() returning
> 'true' during the last phase of hibernation, in which devices are
> being put into low power states and the sleep state (for example,
> ACPI S4) is finally entered.
> 
> Some device drivers need such a function to check if the system is
> in the final phase of hibernation.  In particular, some SATA drivers
> are going to use it for blacklisting systems in which the disks
> should not be spun down during the last phase of hibernation (the
> BIOS will do that anyway).
>

Hi Rafael,

Why not using the power event notifier?

Frederic.

 
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
> ---
>  include/linux/suspend.h |    2 ++
>  kernel/power/disk.c     |   10 ++++++++++
>  2 files changed, 12 insertions(+)
> 
> Index: linux-2.6/include/linux/suspend.h
> ===================================================================
> --- linux-2.6.orig/include/linux/suspend.h
> +++ linux-2.6/include/linux/suspend.h
> @@ -237,6 +237,7 @@ extern int hibernate_nvs_alloc(void);
>  extern void hibernate_nvs_free(void);
>  extern void hibernate_nvs_save(void);
>  extern void hibernate_nvs_restore(void);
> +extern bool system_entering_hibernation(void);
>  #else /* CONFIG_HIBERNATION */
>  static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }
>  static inline void swsusp_set_page_free(struct page *p) {}
> @@ -252,6 +253,7 @@ static inline int hibernate_nvs_alloc(vo
>  static inline void hibernate_nvs_free(void) {}
>  static inline void hibernate_nvs_save(void) {}
>  static inline void hibernate_nvs_restore(void) {}
> +static inline bool system_entering_hibernation(void) { return false; }
>  #endif /* CONFIG_HIBERNATION */
>  
>  #ifdef CONFIG_PM_SLEEP
> Index: linux-2.6/kernel/power/disk.c
> ===================================================================
> --- linux-2.6.orig/kernel/power/disk.c
> +++ linux-2.6/kernel/power/disk.c
> @@ -71,6 +71,14 @@ void hibernation_set_ops(struct platform
>  	mutex_unlock(&pm_mutex);
>  }
>  
> +static bool entering_platform_hibernation;
> +
> +bool system_entering_hibernation(void)
> +{
> +	return entering_platform_hibernation;
> +}
> +EXPORT_SYMBOL(system_entering_hibernation);
> +
>  #ifdef CONFIG_PM_DEBUG
>  static void hibernation_debug_sleep(void)
>  {
> @@ -411,6 +419,7 @@ int hibernation_platform_enter(void)
>  	if (error)
>  		goto Close;
>  
> +	entering_platform_hibernation = true;
>  	suspend_console();
>  	error = device_suspend(PMSG_HIBERNATE);
>  	if (error) {
> @@ -445,6 +454,7 @@ int hibernation_platform_enter(void)
>   Finish:
>  	hibernation_ops->finish();
>   Resume_devices:
> +	entering_platform_hibernation = false;
>  	device_resume(PMSG_RESTORE);
>  	resume_console();
>   Close:
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/


  reply	other threads:[~2009-01-19 21:25 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-04  6:27 [git patches] libata hibernation fixes Jeff Garzik
2008-11-04 16:29 ` Linus Torvalds
2008-11-04 16:53   ` Rafael J. Wysocki
2008-11-04 16:59     ` Mark Lord
2008-11-04 17:07       ` Rafael J. Wysocki
2008-11-05  2:17         ` Tejun Heo
2008-11-04 20:30   ` Pavel Machek
2008-11-04 21:08     ` Rafael J. Wysocki
2008-11-04 21:12     ` Linus Torvalds
2008-11-05  2:23       ` Tejun Heo
2008-11-05  2:42   ` Tejun Heo
2008-11-10  8:52     ` Tejun Heo
2009-01-02  2:36 ` Tejun Heo
2009-01-05  8:34   ` Jeff Garzik
2009-01-11  5:44   ` Jeff Garzik
2009-01-11 12:43     ` Rafael J. Wysocki
2009-01-18 10:20       ` Frans Pop
2009-01-18 20:25         ` Rafael J. Wysocki
2009-01-18 20:39           ` Jeff Garzik
2009-01-19 19:53             ` [PATCH 0/6] Hibernation/poweroff quirks (was: Re: [git patches] libata hibernation fixes) Rafael J. Wysocki
2009-01-19 19:54               ` [PATCH 1/6] Hibernation: Introduce system_entering_hibernation Rafael J. Wysocki
2009-01-19 21:25                 ` Frederic Weisbecker [this message]
2009-01-19 21:35                   ` Rafael J. Wysocki
2009-01-19 21:48                     ` Frederic Weisbecker
2009-01-20  7:30                 ` Maciej Rutecki
2009-01-29 13:04                 ` Pavel Machek
2009-01-29 14:51                   ` Rafael J. Wysocki
2009-01-19 19:55               ` [PATCH 2/6] DMI: Introduce dmi_first_match to make the interface more flexible Rafael J. Wysocki
2009-01-19 21:15                 ` Frans Pop
2009-01-20  7:30                 ` Maciej Rutecki
2009-01-19 19:56               ` [PATCH 3/6] SATA: Blacklisting of systems that spin off disks during ACPI power off Rafael J. Wysocki
2009-01-20  7:31                 ` Maciej Rutecki
2009-01-19 19:57               ` [PATCH 4/6] SATA AHCI: Blacklist system that spins " Rafael J. Wysocki
2009-01-20  7:31                 ` Maciej Rutecki
2009-01-19 19:58               ` [PATCH 5/6] SATA Sil: " Rafael J. Wysocki
2009-01-20  7:32                 ` Maciej Rutecki
2009-01-19 19:59               ` [PATCH 6/6] SATA PIIX: " Rafael J. Wysocki
2009-01-19 22:08                 ` Frans Pop
2009-01-20  7:33                 ` Maciej Rutecki
2009-01-18 20:59           ` [git patches] libata hibernation fixes Frans Pop
2009-01-18 22:52             ` Rafael J. Wysocki
  -- strict thread matches above, loose matches on Subject: below --
2008-08-28 22:02 Regression: SATA disk double spin-off during hibernation on hp nx6325 Rafael J. Wysocki
2008-10-03 15:03 ` [PATCH 1/6] Hibernation: Introduce new system state for the last phase of hibernation Rafael J. Wysocki
2008-10-03 21:48   ` [PATCH 0/6] SATA: Blacklist systems that spin off disks during ACPI power off (rev. 2) Rafael J. Wysocki
2008-10-03 21:51     ` [PATCH 1/6] Hibernation: Introduce system_entering_hibernation Rafael J. Wysocki
2008-10-03 23:27       ` Alan Cox
2008-10-04 10:13         ` Rafael J. Wysocki
2008-10-04 21:50           ` Alan Cox
2008-10-04 21:52             ` Tejun Heo
2008-10-04 22:30               ` Rafael J. Wysocki
2008-10-04 22:27                 ` Tejun Heo
2008-10-04  7:02       ` Tejun Heo
2008-10-04 10:14         ` Rafael J. Wysocki

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=20090119212428.GB6194@nowhere \
    --to=fweisbec@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=elendil@planet.nl \
    --cc=jeff@garzik.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rjw@sisk.pl \
    --cc=tj@kernel.org \
    --cc=torvalds@linux-foundation.org \
    /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;
as well as URLs for NNTP newsgroup(s).