Commit a556d5b5 authored by Srivatsa S. Bhat's avatar Srivatsa S. Bhat Committed by Rafael J. Wysocki
Browse files

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: default avatarSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
parent 51d6ff7a
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -629,12 +629,8 @@ int hibernate(void)
		goto Finish;

	error = hibernation_snapshot(hibernation_mode == HIBERNATION_PLATFORM);
	if (error)
		goto Thaw;
	if (freezer_test_done) {
		freezer_test_done = false;
	if (error || freezer_test_done)
		goto Thaw;
	}

	if (in_suspend) {
		unsigned int flags = 0;
@@ -659,6 +655,10 @@ int hibernate(void)

 Thaw:
	thaw_processes();

	/* Don't bother checking whether freezer_test_done is true */
	freezer_test_done = false;

 Finish:
	free_basic_memory_bitmaps();
	usermodehelper_enable();
+2 −4
Original line number Diff line number Diff line
@@ -251,9 +251,7 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
		error = hibernation_snapshot(data->platform_support);
		if (!error) {
			error = put_user(in_suspend, (int __user *)arg);
			if (!error && !freezer_test_done)
				data->ready = 1;
			if (freezer_test_done)
			data->ready = !freezer_test_done && !error;
			freezer_test_done = false;
		}
		break;