public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Greg KH <greg@kroah.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-pm <linux-pm@lists.osdl.org>
Subject: [PATCH] s2ram: add arch irq disable/enable hooks
Date: Fri, 20 Apr 2007 21:37:18 +0200	[thread overview]
Message-ID: <1177097838.5902.10.camel@johannes.berg> (raw)
In-Reply-To: <20070420173951.GB14778@kroah.com>

Thanks. Does this look good?

Haven't tested it yet but I don't see a reason it shouldn't work for me.

Sparse will probably complain about this, should I define them
somewhere?

---
 kernel/power/main.c |   27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

--- wireless-dev.orig/kernel/power/main.c	2007-04-20 21:34:01.531107385 +0200
+++ wireless-dev/kernel/power/main.c	2007-04-20 21:34:02.141107385 +0200
@@ -128,13 +128,35 @@ static int suspend_prepare(suspend_state
 	return error;
 }
 
+/**
+ * arch_s2ram_disable_irqs - disable IRQs for suspend
+ *
+ * Disables IRQs (in the default case) and allows architectures
+ * to override it if more needs to be done.
+ */
+void __attribute__ ((weak)) arch_s2ram_disable_irqs(unsigned long *flags)
+{
+	local_irq_save(*flags);
+}
+
+/**
+ * arch_s2ram_enable_irqs - enable IRQs after suspend
+ *
+ * Enables IRQs (in the default case) and allows architectures
+ * to override it if more needs to be done.
+ */
+void __attribute__ ((weak)) arch_s2ram_enable_irqs(unsigned long *flags)
+{
+	local_irq_restore(*flags);
+}
 
 int suspend_enter(suspend_state_t state)
 {
 	int error = 0;
 	unsigned long flags;
 
-	local_irq_save(flags);
+	arch_s2ram_disable_irqs(&flags);
+	BUG_ON(!irqs_disabled());
 
 	if ((error = device_power_down(PMSG_SUSPEND))) {
 		printk(KERN_ERR "Some devices failed to power down\n");
@@ -143,7 +165,8 @@ int suspend_enter(suspend_state_t state)
 	error = pm_ops->enter(state);
 	device_power_up();
  Done:
-	local_irq_restore(flags);
+	arch_s2ram_enable_irqs(&flags);
+	BUG_ON(irqs_disabled());
 	return error;
 }
 

  reply	other threads:[~2007-04-20 19:37 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-19 11:00 [PATCH] s2ram: add arch irq disable/enable hooks Johannes Berg
2007-04-19 21:55 ` Andrew Morton
2007-04-20 15:34   ` Johannes Berg
2007-04-20  6:57 ` Greg KH
2007-04-20 15:31   ` Johannes Berg
2007-04-20 17:39     ` Greg KH
2007-04-20 19:37       ` Johannes Berg [this message]
2007-04-20 19:44         ` Andrew Morton
2007-04-20 19:51           ` Johannes Berg
2007-04-20 20:36             ` Rafael J. Wysocki
2007-04-20 20:51               ` Johannes Berg
2007-04-20 21:08                 ` Rafael J. Wysocki
2007-04-21 13:57 ` Johannes Berg
2007-04-21 14:07   ` Pavel Machek
2007-04-21 15:41   ` David Brownell
2007-04-21 16:16     ` Johannes Berg
2007-04-21 16:55       ` David Brownell
2007-04-21 17:01         ` Johannes Berg
2007-04-21 17:06           ` David Brownell
2007-04-21 17:49             ` Johannes Berg
2007-04-21 21:47               ` Pavel Machek
2007-04-21 22:04                 ` Johannes Berg
2007-04-21 21:45             ` Pavel Machek
2007-04-22  3:10               ` David Brownell
2007-04-22 13:09                 ` Pavel Machek
2007-04-26 11:02                   ` David Woodhouse
2007-04-21 21:44     ` Pavel Machek
2007-04-22  3:05       ` David Brownell
2007-04-22 13:13         ` Pavel Machek
2007-04-24 13:51           ` Johannes Berg
2007-04-24 18:16             ` Pavel Machek
2007-04-25  3:45               ` David Brownell
  -- strict thread matches above, loose matches on Subject: below --
2007-04-05 21:54 [PATCH] pm_ops: add irq enable/disable hooks Johannes Berg
2007-04-17 17:18 ` [PATCH] s2ram: add arch irq disable/enable hooks Johannes Berg
2007-04-18 11:27   ` Pavel Machek

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=1177097838.5902.10.camel@johannes.berg \
    --to=johannes@sipsolutions.net \
    --cc=akpm@linux-foundation.org \
    --cc=greg@kroah.com \
    --cc=linux-pm@lists.osdl.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