aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power/disk.c
diff options
context:
space:
mode:
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