Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 10a1803d authored by Rafael J. Wysocki's avatar Rafael J. Wysocki Committed by Linus Torvalds
Browse files

swsusp: fix hibernation code ordering



Change the code ordering so that hibernation_ops->prepare() is called after
device_suspend().  This is needed so that we don't violate the ACPI
specification, which states that the _PTS and _GTS system-control methods,
executed from acpi_sleep_prepare(), ought to be called after devices have been
put in low power states.

The "Finish" label in hibernation_restore() is moved, because device_suspend()
resumes devices if the suspending of them fails and the restore code ordering
should reflect the hibernation code ordering.

Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
Acked-by: default avatarPavel Machek <pavel@ucw.cz>
Cc: Nigel Cunningham <nigel@nigel.suspend2.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent a634cc10
Loading
Loading
Loading
Loading
+7 −7
Original line number Original line Diff line number Diff line
@@ -133,14 +133,14 @@ int hibernation_snapshot(int platform_mode)
	/* Free memory before shutting down devices. */
	/* Free memory before shutting down devices. */
	error = swsusp_shrink_memory();
	error = swsusp_shrink_memory();
	if (error)
	if (error)
		goto Finish;
		return error;

	error = platform_prepare(platform_mode);
	if (error)
		goto Finish;


	suspend_console();
	suspend_console();
	error = device_suspend(PMSG_FREEZE);
	error = device_suspend(PMSG_FREEZE);
	if (error)
		goto Resume_console;

	error = platform_prepare(platform_mode);
	if (error)
	if (error)
		goto Resume_devices;
		goto Resume_devices;


@@ -159,8 +159,8 @@ int hibernation_snapshot(int platform_mode)
 Resume_devices:
 Resume_devices:
	platform_finish(platform_mode);
	platform_finish(platform_mode);
	device_resume();
	device_resume();
 Resume_console:
	resume_console();
	resume_console();
 Finish:
	return error;
	return error;
}
}


@@ -191,8 +191,8 @@ int hibernation_restore(int platform_mode)
		enable_nonboot_cpus();
		enable_nonboot_cpus();
	}
	}
	platform_restore_cleanup(platform_mode);
	platform_restore_cleanup(platform_mode);
 Finish:
	device_resume();
	device_resume();
 Finish:
	resume_console();
	resume_console();
	pm_restore_console();
	pm_restore_console();
	return error;
	return error;