aboutsummaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2007-04-26 11:43:58 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2007-04-27 10:57:33 -0700
commita53c46dc8253cc613ad66a2ca7aad6de8b7e61b9 (patch)
tree5b041cbe147597efb337525ad8260128cc8bc2b0 /kernel
parent075c1771526c85849ed22298d048bc07e400aee5 (diff)
s2ram: add arch irq disable/enable hooks
After some more discussion this patch replaces it: From: Johannes Berg <johannes@sipsolutions.net> Subject: suspend: add arch irq disable/enable hooks For powermac, we need to do some things between suspending devices and device_power_off, for example setting the decrementer. This patch allows architectures to define arch_s2ram_{en,dis}able_irqs in their asm/suspend.h to have control over this step. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Acked-by: Pavel Machek <pavel@ucw.cz> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/power/main.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/kernel/power/main.c b/kernel/power/main.c
index a064dfd8877..3062e940d1f 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -111,13 +111,24 @@ static int suspend_prepare(suspend_state_t state)
return error;
}
+/* default implementation */
+void __attribute__ ((weak)) arch_suspend_disable_irqs(void)
+{
+ local_irq_disable();
+}
+
+/* default implementation */
+void __attribute__ ((weak)) arch_suspend_enable_irqs(void)
+{
+ local_irq_enable();
+}
int suspend_enter(suspend_state_t state)
{
int error = 0;
- unsigned long flags;
- local_irq_save(flags);
+ arch_suspend_disable_irqs();
+ BUG_ON(!irqs_disabled());
if ((error = device_power_down(PMSG_SUSPEND))) {
printk(KERN_ERR "Some devices failed to power down\n");
@@ -126,7 +137,8 @@ int suspend_enter(suspend_state_t state)
error = pm_ops->enter(state);
device_power_up();
Done:
- local_irq_restore(flags);
+ arch_suspend_enable_irqs();
+ BUG_ON(irqs_disabled());
return error;
}