From: tom.leiming@gmail.com
To: rjw@sisk.pl, stern@rowland.harvard.edu
Cc: linux-pm@lists.linux-foundation.org
Subject: [PATCH] PM: runtime: return at once for active device in rpm_resume
Date: Wed, 15 Jun 2011 00:09:53 +0800 [thread overview]
Message-ID: <1308067793-19551-1-git-send-email-tom.leiming@gmail.com> (raw)
From: Ming Lei <tom.leiming@gmail.com>
This patch moves ahead check for active rpm state of device,
so that rpm_resume can return immediately for device with
active rpm state.
Considered rpm_resume is run in atomic context and is often in
hot path(such as in usbnet, called before transmitting every
network frame), this patch should make sense.
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---
drivers/base/power/runtime.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
index 0d4587b..dcc3008 100644
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -455,6 +455,11 @@ static int rpm_resume(struct device *dev, int rpmflags)
dev_dbg(dev, "%s flags 0x%x\n", __func__, rpmflags);
repeat:
+ if (dev->power.runtime_status == RPM_ACTIVE) {
+ retval = 1;
+ goto out;
+ }
+
if (dev->power.runtime_error)
retval = -EINVAL;
else if (dev->power.disable_depth > 0)
@@ -472,11 +477,6 @@ static int rpm_resume(struct device *dev, int rpmflags)
if (!dev->power.timer_autosuspends)
pm_runtime_deactivate_timer(dev);
- if (dev->power.runtime_status == RPM_ACTIVE) {
- retval = 1;
- goto out;
- }
-
if (dev->power.runtime_status == RPM_RESUMING
|| dev->power.runtime_status == RPM_SUSPENDING) {
DEFINE_WAIT(wait);
--
1.7.4.1
next reply other threads:[~2011-06-14 16:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-14 16:09 tom.leiming [this message]
2011-06-14 19:58 ` [PATCH] PM: runtime: return at once for active device in rpm_resume Rafael J. Wysocki
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=1308067793-19551-1-git-send-email-tom.leiming@gmail.com \
--to=tom.leiming@gmail.com \
--cc=linux-pm@lists.linux-foundation.org \
--cc=rjw@sisk.pl \
--cc=stern@rowland.harvard.edu \
/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