Re: PCI PM: Restore standard config registers of all devices early

Linus Torvalds
2009-02-02T22:10:39Z

On Mon, 2 Feb 2009, Linus Torvalds wrote:
>
> Ingo: how do we walk over all the interrupt descriptors in todays world?
> The whole sparse-vs-nonsparse makes things a bit more complex.

Stage#2 would look something like this, except I haven't written the
"[disable|enable]_device_interrupts()" for the simple reason that I'd like
somebody else to do it ;)

But it would basically be just

for (irq = 1; irq < NR_IRQS; irq++)
[disable|enable]_irq(irq);

with maybe some day some way of marking system interrupts separately (ie
timers).

Linus

---
kernel/power/main.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/kernel/power/main.c b/kernel/power/main.c
index 7709556..f54acb6 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -290,14 +290,15 @@ static int suspend_enter(suspend_state_t state)
int error = 0;

device_pm_lock();
- arch_suspend_disable_irqs();
- BUG_ON(!irqs_disabled());
-
+ disable_device_interrupts();
if ((error = device_power_down(PMSG_SUSPEND))) {
printk(KERN_ERR "PM: Some devices failed to power down\n");
goto Done;
}

+ arch_suspend_disable_irqs();
+ BUG_ON(!irqs_disabled());
+
error = sysdev_suspend();
if (!error) {
if (!suspend_test(TEST_CORE))
@@ -305,10 +306,12 @@ static int suspend_enter(suspend_state_t state)
sysdev_resume();
}

- device_power_up(PMSG_RESUME);
- Done:
arch_suspend_enable_irqs();
BUG_ON(irqs_disabled());
+
+ device_power_up(PMSG_RESUME);
+ Done:
+ enable_device_interrupts();
device_pm_unlock();
return error;
}