From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Chuansheng Liu <chuansheng.liu@intel.com>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PM / Runtime: Fix the twice judgement in rpm_suspend/resume()
Date: Mon, 14 Jan 2013 13:32:04 +0100 [thread overview]
Message-ID: <2969423.iZ1VgpHf54@vostro.rjw.lan> (raw)
In-Reply-To: <1358185698.1223.13.camel@cliu38-desktop-build>
On Tuesday, January 15, 2013 01:48:18 AM Chuansheng Liu wrote:
>
> In function rpm_suspend/resume(), when going into the for(;;),
> the pre-condition judgement has been done, and the variable runtime_status
> are always protected by &power.lock, so it is not necessary to judge
> them again before unlock_irq &power.lock in for(;;).
>
> This patch clean them up.
Well, I don't really think this fixes anything. Yes, we may save one check
here and there, but the current code follows the wait_event() convention.
Thanks,
Rafael
> Signed-off-by: liu chuansheng <chuansheng.liu@intel.com>
> ---
> drivers/base/power/runtime.c | 18 +++++++++---------
> 1 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
> index 3148b10..32d6497 100644
> --- a/drivers/base/power/runtime.c
> +++ b/drivers/base/power/runtime.c
> @@ -377,14 +377,14 @@ static int rpm_suspend(struct device *dev, int rpmflags)
> for (;;) {
> prepare_to_wait(&dev->power.wait_queue, &wait,
> TASK_UNINTERRUPTIBLE);
> - if (dev->power.runtime_status != RPM_SUSPENDING)
> - break;
>
> spin_unlock_irq(&dev->power.lock);
>
> schedule();
>
> spin_lock_irq(&dev->power.lock);
> + if (dev->power.runtime_status != RPM_SUSPENDING)
> + break;
> }
> finish_wait(&dev->power.wait_queue, &wait);
> goto repeat;
> @@ -557,15 +557,15 @@ static int rpm_resume(struct device *dev, int rpmflags)
> for (;;) {
> prepare_to_wait(&dev->power.wait_queue, &wait,
> TASK_UNINTERRUPTIBLE);
> - if (dev->power.runtime_status != RPM_RESUMING
> - && dev->power.runtime_status != RPM_SUSPENDING)
> - break;
>
> spin_unlock_irq(&dev->power.lock);
>
> schedule();
>
> spin_lock_irq(&dev->power.lock);
> + if (dev->power.runtime_status != RPM_RESUMING
> + && dev->power.runtime_status != RPM_SUSPENDING)
> + break;
> }
> finish_wait(&dev->power.wait_queue, &wait);
> goto repeat;
> @@ -989,15 +989,15 @@ static void __pm_runtime_barrier(struct device *dev)
> for (;;) {
> prepare_to_wait(&dev->power.wait_queue, &wait,
> TASK_UNINTERRUPTIBLE);
> - if (dev->power.runtime_status != RPM_SUSPENDING
> - && dev->power.runtime_status != RPM_RESUMING
> - && !dev->power.idle_notification)
> - break;
> spin_unlock_irq(&dev->power.lock);
>
> schedule();
>
> spin_lock_irq(&dev->power.lock);
> + if (dev->power.runtime_status != RPM_SUSPENDING
> + && dev->power.runtime_status != RPM_RESUMING
> + && !dev->power.idle_notification)
> + break;
> }
> finish_wait(&dev->power.wait_queue, &wait);
> }
>
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
next prev parent reply other threads:[~2013-01-14 12:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-14 17:48 Chuansheng Liu
2013-01-14 12:32 ` Rafael J. Wysocki [this message]
2013-01-14 15:30 ` Alan Stern
2013-01-15 1:20 ` Liu, Chuansheng
2013-01-15 15:50 ` Alan Stern
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=2969423.iZ1VgpHf54@vostro.rjw.lan \
--to=rjw@sisk.pl \
--cc=chuansheng.liu@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.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
all inboxes | Powered by JetHome®