From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
Cc: Tejun Heo <tj@kernel.org>,
pavel@ucw.cz, len.brown@intel.com, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PM/Hibernate: Refactor and simplify freezer_test_done
Date: Sat, 4 Feb 2012 23:44:20 +0100 [thread overview]
Message-ID: <201202042344.20253.rjw@sisk.pl> (raw)
In-Reply-To: <4F2D3455.4020505@linux.vnet.ibm.com>
On Saturday, February 04, 2012, Srivatsa S. Bhat wrote:
> On 02/02/2012 10:47 PM, Tejun Heo wrote:
>
> > On Thu, Feb 02, 2012 at 07:10:19AM +0530, Srivatsa S. Bhat wrote:
> >> @@ -251,10 +251,10 @@ 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)
> >> freezer_test_done = false;
> >> + else if (!error)
> >> + data->ready = 1;
> >
> > Hmmm... how about..
> >
> > data->ready = !freezer_test_done && !error;
> > freezer_test_done = false;
> >
>
>
> That looks even better, thanks!
>
> Here is the updated patch:
>
> From: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
> Subject: [PATCH] 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: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Applied.
Thanks,
Rafael
> ---
>
> kernel/power/hibernate.c | 10 +++++-----
> kernel/power/user.c | 6 ++----
> 2 files changed, 7 insertions(+), 9 deletions(-)
>
> diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
> index c6dee73..72baaf0 100644
> --- a/kernel/power/hibernate.c
> +++ b/kernel/power/hibernate.c
> @@ -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();
> diff --git a/kernel/power/user.c b/kernel/power/user.c
> index 7bee91f..33c4329 100644
> --- a/kernel/power/user.c
> +++ b/kernel/power/user.c
> @@ -251,10 +251,8 @@ 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)
> - freezer_test_done = false;
> + data->ready = !freezer_test_done && !error;
> + freezer_test_done = false;
> }
> break;
>
>
>
>
>
prev parent reply other threads:[~2012-02-04 22:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-02 1:40 [PATCH] PM/Hibernate: Refactor and simplify freezer_test_done Srivatsa S. Bhat
2012-02-02 17:17 ` Tejun Heo
2012-02-04 13:36 ` Srivatsa S. Bhat
2012-02-04 22:44 ` Rafael J. Wysocki [this message]
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=201202042344.20253.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 \
--cc=tj@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).