Commit 686c4cbb authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'pm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6

* 'pm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6:
  PM: Add missing syscore_suspend() and syscore_resume() calls
  PM: Fix error code paths executed after failing syscore_suspend()
parents b07ad996 19234c08
...@@ -228,6 +228,7 @@ ...@@ -228,6 +228,7 @@
#include <linux/kthread.h> #include <linux/kthread.h>
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/acpi.h> #include <linux/acpi.h>
#include <linux/syscore_ops.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -1238,6 +1239,7 @@ static int suspend(int vetoable) ...@@ -1238,6 +1239,7 @@ static int suspend(int vetoable)
local_irq_disable(); local_irq_disable();
sysdev_suspend(PMSG_SUSPEND); sysdev_suspend(PMSG_SUSPEND);
syscore_suspend();
local_irq_enable(); local_irq_enable();
...@@ -1255,6 +1257,7 @@ static int suspend(int vetoable) ...@@ -1255,6 +1257,7 @@ static int suspend(int vetoable)
apm_error("suspend", err); apm_error("suspend", err);
err = (err == APM_SUCCESS) ? 0 : -EIO; err = (err == APM_SUCCESS) ? 0 : -EIO;
syscore_resume();
sysdev_resume(); sysdev_resume();
local_irq_enable(); local_irq_enable();
...@@ -1280,6 +1283,7 @@ static void standby(void) ...@@ -1280,6 +1283,7 @@ static void standby(void)
local_irq_disable(); local_irq_disable();
sysdev_suspend(PMSG_SUSPEND); sysdev_suspend(PMSG_SUSPEND);
syscore_suspend();
local_irq_enable(); local_irq_enable();
err = set_system_power_state(APM_STATE_STANDBY); err = set_system_power_state(APM_STATE_STANDBY);
...@@ -1287,6 +1291,7 @@ static void standby(void) ...@@ -1287,6 +1291,7 @@ static void standby(void)
apm_error("standby", err); apm_error("standby", err);
local_irq_disable(); local_irq_disable();
syscore_resume();
sysdev_resume(); sysdev_resume();
local_irq_enable(); local_irq_enable();
......
...@@ -73,6 +73,7 @@ int syscore_suspend(void) ...@@ -73,6 +73,7 @@ int syscore_suspend(void)
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(syscore_suspend);
/** /**
* syscore_resume - Execute all the registered system core resume callbacks. * syscore_resume - Execute all the registered system core resume callbacks.
...@@ -95,6 +96,7 @@ void syscore_resume(void) ...@@ -95,6 +96,7 @@ void syscore_resume(void)
"Interrupts enabled after %pF\n", ops->resume); "Interrupts enabled after %pF\n", ops->resume);
} }
} }
EXPORT_SYMBOL_GPL(syscore_resume);
#endif /* CONFIG_PM_SLEEP */ #endif /* CONFIG_PM_SLEEP */
/** /**
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <linux/sysrq.h> #include <linux/sysrq.h>
#include <linux/stop_machine.h> #include <linux/stop_machine.h>
#include <linux/freezer.h> #include <linux/freezer.h>
#include <linux/syscore_ops.h>
#include <xen/xen.h> #include <xen/xen.h>
#include <xen/xenbus.h> #include <xen/xenbus.h>
...@@ -70,8 +71,13 @@ static int xen_suspend(void *data) ...@@ -70,8 +71,13 @@ static int xen_suspend(void *data)
BUG_ON(!irqs_disabled()); BUG_ON(!irqs_disabled());
err = sysdev_suspend(PMSG_FREEZE); err = sysdev_suspend(PMSG_FREEZE);
if (!err) {
err = syscore_suspend();
if (err)
sysdev_resume();
}
if (err) { if (err) {
printk(KERN_ERR "xen_suspend: sysdev_suspend failed: %d\n", printk(KERN_ERR "xen_suspend: system core suspend failed: %d\n",
err); err);
return err; return err;
} }
...@@ -95,6 +101,7 @@ static int xen_suspend(void *data) ...@@ -95,6 +101,7 @@ static int xen_suspend(void *data)
xen_timer_resume(); xen_timer_resume();
} }
syscore_resume();
sysdev_resume(); sysdev_resume();
return 0; return 0;
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/swap.h> #include <linux/swap.h>
#include <linux/kmsg_dump.h> #include <linux/kmsg_dump.h>
#include <linux/syscore_ops.h>
#include <asm/page.h> #include <asm/page.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -1532,6 +1533,11 @@ int kernel_kexec(void) ...@@ -1532,6 +1533,11 @@ int kernel_kexec(void)
local_irq_disable(); local_irq_disable();
/* Suspend system devices */ /* Suspend system devices */
error = sysdev_suspend(PMSG_FREEZE); error = sysdev_suspend(PMSG_FREEZE);
if (!error) {
error = syscore_suspend();
if (error)
sysdev_resume();
}
if (error) if (error)
goto Enable_irqs; goto Enable_irqs;
} else } else
...@@ -1546,6 +1552,7 @@ int kernel_kexec(void) ...@@ -1546,6 +1552,7 @@ int kernel_kexec(void)
#ifdef CONFIG_KEXEC_JUMP #ifdef CONFIG_KEXEC_JUMP
if (kexec_image->preserve_context) { if (kexec_image->preserve_context) {
syscore_resume();
sysdev_resume(); sysdev_resume();
Enable_irqs: Enable_irqs:
local_irq_enable(); local_irq_enable();
......
...@@ -273,8 +273,11 @@ static int create_image(int platform_mode) ...@@ -273,8 +273,11 @@ static int create_image(int platform_mode)
local_irq_disable(); local_irq_disable();
error = sysdev_suspend(PMSG_FREEZE); error = sysdev_suspend(PMSG_FREEZE);
if (!error) if (!error) {
error = syscore_suspend(); error = syscore_suspend();
if (error)
sysdev_resume();
}
if (error) { if (error) {
printk(KERN_ERR "PM: Some system devices failed to power down, " printk(KERN_ERR "PM: Some system devices failed to power down, "
"aborting hibernation\n"); "aborting hibernation\n");
...@@ -407,8 +410,11 @@ static int resume_target_kernel(bool platform_mode) ...@@ -407,8 +410,11 @@ static int resume_target_kernel(bool platform_mode)
local_irq_disable(); local_irq_disable();
error = sysdev_suspend(PMSG_QUIESCE); error = sysdev_suspend(PMSG_QUIESCE);
if (!error) if (!error) {
error = syscore_suspend(); error = syscore_suspend();
if (error)
sysdev_resume();
}
if (error) if (error)
goto Enable_irqs; goto Enable_irqs;
......
...@@ -164,8 +164,11 @@ static int suspend_enter(suspend_state_t state) ...@@ -164,8 +164,11 @@ static int suspend_enter(suspend_state_t state)
BUG_ON(!irqs_disabled()); BUG_ON(!irqs_disabled());
error = sysdev_suspend(PMSG_SUSPEND); error = sysdev_suspend(PMSG_SUSPEND);
if (!error) if (!error) {
error = syscore_suspend(); error = syscore_suspend();
if (error)
sysdev_resume();
}
if (!error) { if (!error) {
if (!(suspend_test(TEST_CORE) || pm_wakeup_pending())) { if (!(suspend_test(TEST_CORE) || pm_wakeup_pending())) {
error = suspend_ops->enter(state); error = suspend_ops->enter(state);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment