From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Ming Lei <tom.leiming@gmail.com>
Cc: "Linux-pm mailing list" <linux-pm@lists.linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>,
Alan Stern <stern@rowland.harvard.edu>
Subject: Re: [PATCH] PM: Prevent dpm_prepare() from returning errors unnecessarily
Date: Tue, 30 Nov 2010 23:23:50 +0100 [thread overview]
Message-ID: <201011302323.50475.rjw@sisk.pl> (raw)
In-Reply-To: <AANLkTi=tgEug5EUpqV1-GLFh9rsD5obAyExe+V=CjsbO@mail.gmail.com>
On Tuesday, November 30, 2010, Ming Lei wrote:
> 2010/11/28 Rafael J. Wysocki <rjw@sisk.pl>:
> > From: Rafael J. Wysocki <rjw@sisk.pl>
> >
> > Currently dpm_prepare() returns error code if it finds that a device
> > being suspended has a pending runtime resume request. However, it
> > should not do that if the checking for wakeup events is not enabled.
> > On the other hand, if the checking for wakeup events is enabled, it
> > can return error when a wakeup event is detected, regardless of its
> > source.
> >
> > Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
> > ---
> > drivers/base/power/main.c | 11 +++++++----
> > 1 file changed, 7 insertions(+), 4 deletions(-)
> >
> > Index: linux-2.6/drivers/base/power/main.c
> > ===================================================================
> > --- linux-2.6.orig/drivers/base/power/main.c
> > +++ linux-2.6/drivers/base/power/main.c
> > @@ -26,6 +26,7 @@
> > #include <linux/interrupt.h>
> > #include <linux/sched.h>
> > #include <linux/async.h>
> > +#include <linux/suspend.h>
> >
> > #include "../base.h"
> > #include "power.h"
> > @@ -1052,8 +1053,10 @@ static int dpm_prepare(pm_message_t stat
> > mutex_unlock(&dpm_list_mtx);
> >
> > pm_runtime_get_noresume(dev);
> > - if (pm_runtime_barrier(dev) && device_may_wakeup(dev)) {
> > - /* Wake-up requested during system sleep transition. */
> > + if (pm_runtime_barrier(dev) && device_may_wakeup(dev))
> > + pm_wakeup_event(dev, 0);
> > +
> > + if (pm_check_wakeup_events()) {
>
> If pm_check_wakeup_events returns true, it means there is no wakeup event
> coming, so seems should handle normal suspend prepare, but why
> abort the suspend here?
That's a bug, it should be !pm_check_wakeup_events() instead.
Thanks,
Rafael
prev parent reply other threads:[~2010-11-30 22:24 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-28 12:12 [PATCH] PM: Prevent dpm_prepare() from returning errors unnecessarily Rafael J. Wysocki
2010-11-28 15:35 ` Alan Stern
2010-11-28 22:52 ` Rafael J. Wysocki
2010-11-29 3:05 ` Alan Stern
2010-11-29 22:04 ` Rafael J. Wysocki
2010-11-30 15:13 ` Alan Stern
2010-11-30 22:27 ` Rafael J. Wysocki
2010-12-01 15:15 ` Alan Stern
2010-12-01 23:50 ` Rafael J. Wysocki
2010-12-02 15:38 ` Alan Stern
2010-12-02 19:42 ` Rafael J. Wysocki
2010-11-30 13:07 ` Ming Lei
2010-11-30 22:23 ` 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=201011302323.50475.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=stern@rowland.harvard.edu \
--cc=tom.leiming@gmail.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