diff options
| author | Johannes Berg <johannes@sipsolutions.net> | 2007-04-26 05:43:58 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-04-27 13:57:33 -0400 |
| commit | a53c46dc8253cc613ad66a2ca7aad6de8b7e61b9 (patch) | |
| tree | 5b041cbe147597efb337525ad8260128cc8bc2b0 | |
| parent | 075c1771526c85849ed22298d048bc07e400aee5 (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>
| -rw-r--r-- | include/linux/pm.h | 18 | ||||
| -rw-r--r-- | kernel/power/main.c | 18 |
2 files changed, 33 insertions, 3 deletions
diff --git a/include/linux/pm.h b/include/linux/pm.h index b0ab623adbf5..9bd86db4d395 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
| @@ -166,6 +166,24 @@ extern struct pm_ops *pm_ops; | |||
| 166 | extern int pm_suspend(suspend_state_t state); | 166 | extern int pm_suspend(suspend_state_t state); |
| 167 | 167 | ||
| 168 | 168 | ||
| 169 | /** | ||
| 170 | * arch_suspend_disable_irqs - disable IRQs for suspend | ||
| 171 | * | ||
| 172 | * Disables IRQs (in the default case). This is a weak symbol in the common | ||
| 173 | * code and thus allows architectures to override it if more needs to be | ||
| 174 | * done. Not called for suspend to disk. | ||
| 175 | */ | ||
| 176 | extern void arch_suspend_disable_irqs(void); | ||
| 177 | |||
| 178 | /** | ||
| 179 | * arch_suspend_enable_irqs - enable IRQs after suspend | ||
| 180 | * | ||
| 181 | * Enables IRQs (in the default case). This is a weak symbol in the common | ||
| 182 | * code and thus allows architectures to override it if more needs to be | ||
| 183 | * done. Not called for suspend to disk. | ||
| 184 | */ | ||
| 185 | extern void arch_suspend_enable_irqs(void); | ||
| 186 | |||
| 169 | /* | 187 | /* |
| 170 | * Device power management | 188 | * Device power management |
| 171 | */ | 189 | */ |
diff --git a/kernel/power/main.c b/kernel/power/main.c index a064dfd8877a..3062e940d1fa 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c | |||
| @@ -111,13 +111,24 @@ static int suspend_prepare(suspend_state_t state) | |||
| 111 | return error; | 111 | return error; |
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | /* default implementation */ | ||
| 115 | void __attribute__ ((weak)) arch_suspend_disable_irqs(void) | ||
| 116 | { | ||
| 117 | local_irq_disable(); | ||
| 118 | } | ||
| 119 | |||
| 120 | /* default implementation */ | ||
| 121 | void __attribute__ ((weak)) arch_suspend_enable_irqs(void) | ||
| 122 | { | ||
| 123 | local_irq_enable(); | ||
| 124 | } | ||
| 114 | 125 | ||
| 115 | int suspend_enter(suspend_state_t state) | 126 | int suspend_enter(suspend_state_t state) |
| 116 | { | 127 | { |
| 117 | int error = 0; | 128 | int error = 0; |
| 118 | unsigned long flags; | ||
| 119 | 129 | ||
| 120 | local_irq_save(flags); | 130 | arch_suspend_disable_irqs(); |
| 131 | BUG_ON(!irqs_disabled()); | ||
| 121 | 132 | ||
| 122 | if ((error = device_power_down(PMSG_SUSPEND))) { | 133 | if ((error = device_power_down(PMSG_SUSPEND))) { |
| 123 | printk(KERN_ERR "Some devices failed to power down\n"); | 134 | printk(KERN_ERR "Some devices failed to power down\n"); |
| @@ -126,7 +137,8 @@ int suspend_enter(suspend_state_t state) | |||
| 126 | error = pm_ops->enter(state); | 137 | error = pm_ops->enter(state); |
| 127 | device_power_up(); | 138 | device_power_up(); |
| 128 | Done: | 139 | Done: |
| 129 | local_irq_restore(flags); | 140 | arch_suspend_enable_irqs(); |
| 141 | BUG_ON(irqs_disabled()); | ||
| 130 | return error; | 142 | return error; |
| 131 | } | 143 | } |
| 132 | 144 | ||
