History

PM: introduce set_target method in pm_ops

Commit 52ade9b3b97fd3bea42842a056fe0786c28d0555 changed the suspend code ordering to execute pm_ops->prepare() after the device model per-device .suspend() calls in order to fix some ACPI-related issues. Unfortunately, it broke the at91 platform which assumed that pm_ops->prepare() would be called before suspending devices. at91 used pm_ops->prepare() to get notified of the target system sleep state, so that it could use this information while suspending devices. However, with the current suspend code ordering pm_ops->prepare() is called too late for this purpose. Thus, at91 needs an additional method in 'struct pm_ops' that will be used for notifying the platform of the target system sleep state. Moreover, in the future such a method will also be needed by ACPI. This patch adds the .set_target() method to 'struct pm_ops' and makes the suspend code call it, if implemented, before executing the device model per-device .suspend() calls. It also modifies the at91 code to use pm_ops->set_target() instead of pm_ops->prepare().

Rafael J. Wysocki committed 19 years ago

Commit 2391dae1 parent cbcdd773 files · +54 −18Browse files

Showing the changes to kernel (1 of 3 files). Show all

Unified · Split

kernel/power/main.c+5−1
@@ -15,7 +15,6 @@ · 14 unmodified lines
1515 #include <linux/delay.h>
1616 #include <linux/errno.h>
1717 #include <linux/init.h>
18−#include <linux/pm.h>
1918 #include <linux/console.h>
2019 #include <linux/cpu.h>
2120 #include <linux/resume-trace.h>
@@ -97,6 +96,11 @@ static int suspend_prepare(suspend_state_t state) · 75 unmodified lines
9796 }
9897 }
9998
99+ if (pm_ops->set_target) {
100+ error = pm_ops->set_target(state);
101+ if (error)
102+ goto Thaw;
103+ }
100104 suspend_console();
101105 error = device_suspend(PMSG_SUSPEND);
102106 if (error) {