linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Len Brown <lenb@kernel.org>
Cc: ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	Matthew Garrett <mjg59@srcf.ucam.org>,
	linux-pm@lists.linux-foundation.org
Subject: [PATCH 2/5] ACPI / Sleep: Rework enabling wakeup devices
Date: Fri, 2 Jul 2010 00:12:26 +0200	[thread overview]
Message-ID: <201007020012.27005.rjw@sisk.pl> (raw)
In-Reply-To: <201007020010.13755.rjw@sisk.pl>

From: Rafael J. Wysocki <rjw@sisk.pl>

There is no reason why acpi_enable_wakeup_device() should be called
with interrupts disabled, because it doesn't access hardware.  Thus
it is possible to move it next to acpi_enable_wakeup_device_prep()
and make the ACPI suspend, hibernate and poweroff code more
straightforward.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 drivers/acpi/sleep.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Index: linux-2.6/drivers/acpi/sleep.c
===================================================================
--- linux-2.6.orig/drivers/acpi/sleep.c
+++ linux-2.6/drivers/acpi/sleep.c
@@ -70,10 +70,11 @@ static int acpi_sleep_prepare(u32 acpi_s
 
 	}
 	ACPI_FLUSH_CPU_CACHE();
-	acpi_enable_wakeup_device_prep(acpi_state);
 #endif
 	printk(KERN_INFO PREFIX "Preparing to enter system sleep state S%d\n",
 		acpi_state);
+	acpi_enable_wakeup_device_prep(acpi_state);
+	acpi_enable_wakeup_device(acpi_state);
 	acpi_enter_sleep_state_prep(acpi_state);
 	return 0;
 }
@@ -233,7 +234,6 @@ static int acpi_suspend_enter(suspend_st
 	}
 
 	local_irq_save(flags);
-	acpi_enable_wakeup_device(acpi_state);
 	switch (acpi_state) {
 	case ACPI_STATE_S1:
 		barrier();
@@ -437,7 +437,6 @@ static int acpi_hibernation_enter(void)
 	ACPI_FLUSH_CPU_CACHE();
 
 	local_irq_save(flags);
-	acpi_enable_wakeup_device(ACPI_STATE_S4);
 	/* This shouldn't return.  If it returns, we have a problem */
 	status = acpi_enter_sleep_state(ACPI_STATE_S4);
 	/* Reprogram control registers and execute _BFS */
@@ -682,7 +681,6 @@ static void acpi_power_off(void)
 	/* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */
 	printk(KERN_DEBUG "%s called\n", __func__);
 	local_irq_disable();
-	acpi_enable_wakeup_device(ACPI_STATE_S5);
 	acpi_enter_sleep_state(ACPI_STATE_S5);
 }
 


  parent reply	other threads:[~2010-07-01 22:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-01 22:10 [PATCH 0/5] ACPI / PM: Fixes and simplifications Rafael J. Wysocki
2010-07-01 22:11 ` [PATCH 1/5] ACPI / Sleep: Do not allocate memory for saving NVS in advance Rafael J. Wysocki
2010-07-06 18:12   ` [linux-pm] " Rafael J. Wysocki
2010-07-07  2:16   ` Len Brown
2010-07-01 22:12 ` Rafael J. Wysocki [this message]
2010-07-07  2:16   ` [PATCH 2/5] ACPI / Sleep: Rework enabling wakeup devices Len Brown
2010-07-01 22:13 ` [PATCH 3/5] ACPI / Wakeup: Simplify enabling of " Rafael J. Wysocki
2010-07-06 23:17   ` [linux-pm] " Rafael J. Wysocki
2010-07-07  2:13     ` Len Brown
2010-07-01 22:14 ` [PATCH 4/5] ACPI / Sleep: Consolidate suspend and hibernation routines Rafael J. Wysocki
2010-07-07  2:14   ` Len Brown
2010-07-01 22:14 ` [PATCH 5/5] ACPI / Sleep: Drop acpi_suspend_finish() Rafael J. Wysocki
2010-07-07  2:14   ` Len Brown

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=201007020012.27005.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=mjg59@srcf.ucam.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).