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

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

Hibernation: prepare to enter the low power state



During hibernation we call hibernation_ops->prepare() before creating the image,
but then, before saving it, we cancel the power transition by calling
hibernation_ops->finish().  Thus prior to calling hibernation_ops->enter() we
should let the platform firmware know that we're going to enter the low power
state after all.

Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
Cc: Gautham R Shenoy <ego@in.ibm.com>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Nigel Cunningham <nigel@nigel.suspend2.net>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 10a1803d
Loading
Loading
Loading
Loading
+13 −2
Original line number Original line Diff line number Diff line
@@ -205,12 +205,23 @@ int hibernation_restore(int platform_mode)


int hibernation_platform_enter(void)
int hibernation_platform_enter(void)
{
{
	int error;

	if (hibernation_ops) {
	if (hibernation_ops) {
		kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
		kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
		return hibernation_ops->enter();
		/*
		 * We have cancelled the power transition by running
		 * hibernation_ops->finish() before saving the image, so we
		 * should let the firmware know that we're going to enter the
		 * sleep state after all
		 */
		error = hibernation_ops->prepare();
		if (!error)
			error = hibernation_ops->enter();
	} else {
	} else {
		return -ENOSYS;
		error = -ENOSYS;
	}
	}
	return error;
}
}


/**
/**