From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
Cc: pavel@ucw.cz, len.brown@intel.com, linux-kernel@vger.kernel.org,
linux-pm@vger.kernel.org
Subject: Re: [PATCH] PM / Hibernation: Refactor and simplify hibernation_snapshot() code
Date: Tue, 22 Nov 2011 23:29:09 +0100 [thread overview]
Message-ID: <201111222329.09534.rjw@sisk.pl> (raw)
In-Reply-To: <20111122212500.11648.2252.stgit@srivatsabhat.in.ibm.com>
On Tuesday, November 22, 2011, Srivatsa S. Bhat wrote:
> The goto statements in hibernation_snapshot() are a bit complex.
> Refactor the code to remove some of them, thereby simplifying the
> implementation.
>
> Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Applied to linux-pm/linux-next.
Thanks,
Rafael
> ---
> This is on top of the patch posted at https://lkml.org/lkml/2011/11/21/498
>
> kernel/power/hibernate.c | 22 +++++++++-------------
> 1 files changed, 9 insertions(+), 13 deletions(-)
>
> diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
> index a6b0503..ebf62c3 100644
> --- a/kernel/power/hibernate.c
> +++ b/kernel/power/hibernate.c
> @@ -333,7 +333,7 @@ static int create_image(int platform_mode)
> */
> int hibernation_snapshot(int platform_mode)
> {
> - pm_message_t msg = PMSG_RECOVER;
> + pm_message_t msg;
> int error;
>
> error = platform_begin(platform_mode);
> @@ -362,26 +362,26 @@ int hibernation_snapshot(int platform_mode)
>
> error = dpm_prepare(PMSG_FREEZE);
> if (error) {
> - dpm_complete(msg);
> + dpm_complete(PMSG_RECOVER);
> goto Cleanup;
> }
>
> suspend_console();
> pm_restrict_gfp_mask();
> +
> error = dpm_suspend(PMSG_FREEZE);
> - if (error)
> - goto Recover_platform;
>
> - if (hibernation_test(TEST_DEVICES))
> - goto Recover_platform;
> + if (error || hibernation_test(TEST_DEVICES))
> + platform_recover(platform_mode);
> + else
> + error = create_image(platform_mode);
>
> - error = create_image(platform_mode);
> /*
> - * Control returns here (1) after the image has been created or the
> + * In the case that we call create_image() above, the control
> + * returns here (1) after the image has been created or the
> * image creation has failed and (2) after a successful restore.
> */
>
> - Resume_devices:
> /* We may need to release the preallocated image pages here. */
> if (error || !in_suspend)
> swsusp_free();
> @@ -399,10 +399,6 @@ int hibernation_snapshot(int platform_mode)
> platform_end(platform_mode);
> return error;
>
> - Recover_platform:
> - platform_recover(platform_mode);
> - goto Resume_devices;
> -
> Cleanup:
> swsusp_free();
> goto Close;
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
next prev parent reply other threads:[~2011-11-22 22:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-22 21:25 Srivatsa S. Bhat
2011-11-22 22:29 ` Rafael J. Wysocki [this message]
2011-11-24 9:51 ` Pavel Machek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201111222329.09534.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=srivatsa.bhat@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®