aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power/disk.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2007-10-18 06:04:42 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-18 17:37:18 -0400
commit74f270af0c1ed5b9d4413784256959dcfe3593ce (patch)
tree5b74248167be086b0050a84f9ebe072bbb43fdb3 /kernel/power/disk.c
parentf242d9196fd1ef4e6bf0e50d2e7f32866fb145c2 (diff)
PM: Rework struct hibernation_ops
During hibernation we also need to tell the ACPI core that we're going to put the system into the S4 sleep state. For this reason, an additional method in 'struct hibernation_ops' is needed, playing the role of set_target() in 'struct platform_suspend_operations'. Moreover, the role of the .prepare() method is now different, so it's better to introduce another method, that in general may be different from .prepare(), that will be used to prepare the platform for creating the hibernation image (.prepare() is used anyway to notify the platform that we're going to enter the low power state after the image has been saved). Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/power/disk.c')
-rw-r--r--kernel/power/disk.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/kernel/power/disk.c b/kernel/power/disk.c
index eb72255b5c86..d17bb14bce7b 100644
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
@@ -54,8 +54,9 @@ static struct hibernation_ops *hibernation_ops;
54 54
55void hibernation_set_ops(struct hibernation_ops *ops) 55void hibernation_set_ops(struct hibernation_ops *ops)
56{ 56{
57 if (ops && !(ops->prepare && ops->enter && ops->finish 57 if (ops && !(ops->start && ops->pre_snapshot && ops->finish
58 && ops->pre_restore && ops->restore_cleanup)) { 58 && ops->prepare && ops->enter && ops->pre_restore
59 && ops->restore_cleanup)) {
59 WARN_ON(1); 60 WARN_ON(1);
60 return; 61 return;
61 } 62 }
@@ -69,16 +70,26 @@ void hibernation_set_ops(struct hibernation_ops *ops)
69 mutex_unlock(&pm_mutex); 70 mutex_unlock(&pm_mutex);
70} 71}
71 72
73/**
74 * platform_start - tell the platform driver that we're starting
75 * hibernation
76 */
77
78static int platform_start(int platform_mode)
79{
80 return (platform_mode && hibernation_ops) ?
81 hibernation_ops->start() : 0;
82}
72 83
73/** 84/**
74 * platform_prepare - prepare the machine for hibernation using the 85 * platform_pre_snapshot - prepare the machine for hibernation using the
75 * platform driver if so configured and return an error code if it fails 86 * platform driver if so configured and return an error code if it fails
76 */ 87 */
77 88
78static int platform_prepare(int platform_mode) 89static int platform_pre_snapshot(int platform_mode)
79{ 90{
80 return (platform_mode && hibernation_ops) ? 91 return (platform_mode && hibernation_ops) ?
81 hibernation_ops->prepare() : 0; 92 hibernation_ops->pre_snapshot() : 0;
82} 93}
83 94
84/** 95/**
@@ -135,12 +146,16 @@ int hibernation_snapshot(int platform_mode)
135 if (error) 146 if (error)
136 return error; 147 return error;
137 148
149 error = platform_start(platform_mode);
150 if (error)
151 return error;
152
138 suspend_console(); 153 suspend_console();
139 error = device_suspend(PMSG_FREEZE); 154 error = device_suspend(PMSG_FREEZE);
140 if (error) 155 if (error)
141 goto Resume_console; 156 goto Resume_console;
142 157
143 error = platform_prepare(platform_mode); 158 error = platform_pre_snapshot(platform_mode);
144 if (error) 159 if (error)
145 goto Resume_devices; 160 goto Resume_devices;
146 161