aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2008-01-07 18:08:44 -0500
committerLen Brown <len.brown@intel.com>2008-02-01 18:30:58 -0500
commitcaea99ef339af8e07cda8d03fa415e4b8820f400 (patch)
tree46b975f61a3409a30fc6a7c15a6db2c7f6d9876b /kernel/power
parent60417f5976df029227450b46d7fa6f0e9b1e654c (diff)
Hibernation: Introduce begin() and end() callbacks
Introduce global hibernation callback .end() and rename global hibernation callback .start() to .begin(), in analogy with the recent modifications of the global suspend callbacks. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'kernel/power')
-rw-r--r--kernel/power/disk.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/kernel/power/disk.c b/kernel/power/disk.c
index 64e42ab8b57c..53c22d9cf577 100644
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
@@ -54,8 +54,8 @@ static struct platform_hibernation_ops *hibernation_ops;
54 54
55void hibernation_set_ops(struct platform_hibernation_ops *ops) 55void hibernation_set_ops(struct platform_hibernation_ops *ops)
56{ 56{
57 if (ops && !(ops->start && ops->pre_snapshot && ops->finish 57 if (ops && !(ops->begin && ops->end && ops->pre_snapshot
58 && ops->prepare && ops->enter && ops->pre_restore 58 && ops->prepare && ops->finish && ops->enter && ops->pre_restore
59 && ops->restore_cleanup)) { 59 && ops->restore_cleanup)) {
60 WARN_ON(1); 60 WARN_ON(1);
61 return; 61 return;
@@ -100,14 +100,25 @@ static int hibernation_test(int level) { return 0; }
100#endif /* !CONFIG_PM_DEBUG */ 100#endif /* !CONFIG_PM_DEBUG */
101 101
102/** 102/**
103 * platform_start - tell the platform driver that we're starting 103 * platform_begin - tell the platform driver that we're starting
104 * hibernation 104 * hibernation
105 */ 105 */
106 106
107static int platform_start(int platform_mode) 107static int platform_begin(int platform_mode)
108{ 108{
109 return (platform_mode && hibernation_ops) ? 109 return (platform_mode && hibernation_ops) ?
110 hibernation_ops->start() : 0; 110 hibernation_ops->begin() : 0;
111}
112
113/**
114 * platform_end - tell the platform driver that we've entered the
115 * working state
116 */
117
118static void platform_end(int platform_mode)
119{
120 if (platform_mode && hibernation_ops)
121 hibernation_ops->end();
111} 122}
112 123
113/** 124/**
@@ -237,9 +248,9 @@ int hibernation_snapshot(int platform_mode)
237 if (error) 248 if (error)
238 return error; 249 return error;
239 250
240 error = platform_start(platform_mode); 251 error = platform_begin(platform_mode);
241 if (error) 252 if (error)
242 return error; 253 goto Close;
243 254
244 suspend_console(); 255 suspend_console();
245 error = device_suspend(PMSG_FREEZE); 256 error = device_suspend(PMSG_FREEZE);
@@ -272,6 +283,8 @@ int hibernation_snapshot(int platform_mode)
272 device_resume(); 283 device_resume();
273 Resume_console: 284 Resume_console:
274 resume_console(); 285 resume_console();
286 Close:
287 platform_end(platform_mode);
275 return error; 288 return error;
276} 289}
277 290
@@ -373,9 +386,9 @@ int hibernation_platform_enter(void)
373 * hibernation_ops->finish() before saving the image, so we should let 386 * hibernation_ops->finish() before saving the image, so we should let
374 * the firmware know that we're going to enter the sleep state after all 387 * the firmware know that we're going to enter the sleep state after all
375 */ 388 */
376 error = hibernation_ops->start(); 389 error = hibernation_ops->begin();
377 if (error) 390 if (error)
378 return error; 391 goto Close;
379 392
380 suspend_console(); 393 suspend_console();
381 error = device_suspend(PMSG_SUSPEND); 394 error = device_suspend(PMSG_SUSPEND);
@@ -409,6 +422,8 @@ int hibernation_platform_enter(void)
409 device_resume(); 422 device_resume();
410 Resume_console: 423 Resume_console:
411 resume_console(); 424 resume_console();
425 Close:
426 hibernation_ops->end();
412 return error; 427 return error;
413} 428}
414 429