提交 a556d5b5 编写于 作者: S Srivatsa S. Bhat 提交者: Rafael J. Wysocki

PM / Hibernate: Refactor and simplify freezer_test_done

The code related to 'freezer_test_done' is needlessly convoluted.
Refactor the code and simplify the implementation.
Signed-off-by: NSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
上级 51d6ff7a
...@@ -629,12 +629,8 @@ int hibernate(void) ...@@ -629,12 +629,8 @@ int hibernate(void)
goto Finish; goto Finish;
error = hibernation_snapshot(hibernation_mode == HIBERNATION_PLATFORM); error = hibernation_snapshot(hibernation_mode == HIBERNATION_PLATFORM);
if (error) if (error || freezer_test_done)
goto Thaw;
if (freezer_test_done) {
freezer_test_done = false;
goto Thaw; goto Thaw;
}
if (in_suspend) { if (in_suspend) {
unsigned int flags = 0; unsigned int flags = 0;
...@@ -659,6 +655,10 @@ int hibernate(void) ...@@ -659,6 +655,10 @@ int hibernate(void)
Thaw: Thaw:
thaw_processes(); thaw_processes();
/* Don't bother checking whether freezer_test_done is true */
freezer_test_done = false;
Finish: Finish:
free_basic_memory_bitmaps(); free_basic_memory_bitmaps();
usermodehelper_enable(); usermodehelper_enable();
......
...@@ -251,10 +251,8 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd, ...@@ -251,10 +251,8 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
error = hibernation_snapshot(data->platform_support); error = hibernation_snapshot(data->platform_support);
if (!error) { if (!error) {
error = put_user(in_suspend, (int __user *)arg); error = put_user(in_suspend, (int __user *)arg);
if (!error && !freezer_test_done) data->ready = !freezer_test_done && !error;
data->ready = 1; freezer_test_done = false;
if (freezer_test_done)
freezer_test_done = false;
} }
break; break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册