From: Magnus Damm <magnus.damm@gmail.com>
To: linux-pm@lists.linux-foundation.org
Cc: gregkh@suse.de
Subject: [PATCH 01/05] PM: Runtime PM v13 - add dev_pm_ops helpers
Date: Fri, 07 Aug 2009 16:33:25 +0900 [thread overview]
Message-ID: <20090807073325.22479.31226.sendpatchset@rx1.opensource.se> (raw)
In-Reply-To: <20090807073315.22479.89012.sendpatchset@rx1.opensource.se>
From: Magnus Damm <damm@igel.co.jp>
This patch breaks out the dev_pm_ops handling code
for Runtime PM into separate functions. This change
makes is possible for the main code and separate
bus implementations to deal with callbacks and error
codes in a consistent fashion.
The broken out functions are used by the Runtime PM
platform device bus implementation for SuperH.
Signed-off-by: Magnus Damm <damm@igel.co.jp>
---
Changes for v11->v13:
- solved conflicts introduced by v11->v13 update
drivers/base/power/runtime.c | 29 ++++++++++-------------------
include/linux/pm_runtime.h | 19 +++++++++++++++++++
2 files changed, 29 insertions(+), 19 deletions(-)
--- 0007/drivers/base/power/runtime.c
+++ work/drivers/base/power/runtime.c 2009-08-07 13:42:57.000000000 +0900
@@ -77,13 +77,12 @@ static int __pm_runtime_idle(struct devi
dev->power.idle_notification = true;
- if (dev->bus && dev->bus->pm && dev->bus->pm->runtime_idle) {
- spin_unlock_irq(&dev->power.lock);
+ spin_unlock_irq(&dev->power.lock);
- dev->bus->pm->runtime_idle(dev);
+ if (dev->bus)
+ pm_runtime_ops_idle(dev, dev->bus->pm);
- spin_lock_irq(&dev->power.lock);
- }
+ spin_lock_irq(&dev->power.lock);
dev->power.idle_notification = false;
wake_up_all(&dev->power.wait_queue);
@@ -173,15 +172,11 @@ int __pm_runtime_suspend(struct device *
dev->power.runtime_status = RPM_SUSPENDING;
- if (dev->bus && dev->bus->pm && dev->bus->pm->runtime_suspend) {
- spin_unlock_irq(&dev->power.lock);
+ spin_unlock_irq(&dev->power.lock);
- retval = dev->bus->pm->runtime_suspend(dev);
+ retval = dev->bus ? pm_runtime_ops_suspend(dev, dev->bus->pm) : -ENOSYS;
- spin_lock_irq(&dev->power.lock);
- } else {
- retval = -ENOSYS;
- }
+ spin_lock_irq(&dev->power.lock);
if (retval) {
dev->power.runtime_status = RPM_ACTIVE;
@@ -332,15 +327,11 @@ int __pm_runtime_resume(struct device *d
dev->power.runtime_status = RPM_RESUMING;
- if (dev->bus && dev->bus->pm && dev->bus->pm->runtime_resume) {
- spin_unlock_irq(&dev->power.lock);
+ spin_unlock_irq(&dev->power.lock);
- retval = dev->bus->pm->runtime_resume(dev);
+ retval = dev->bus ? pm_runtime_ops_resume(dev, dev->bus->pm) : -ENOSYS;
- spin_lock_irq(&dev->power.lock);
- } else {
- retval = -ENOSYS;
- }
+ spin_lock_irq(&dev->power.lock);
if (retval) {
dev->power.runtime_status = RPM_SUSPENDED;
--- 0007/include/linux/pm_runtime.h
+++ work/include/linux/pm_runtime.h 2009-08-07 13:37:27.000000000 +0900
@@ -112,4 +112,23 @@ static inline int pm_runtime_disable(str
return __pm_runtime_disable(dev, true);
}
+static inline int pm_runtime_ops_suspend(struct device *dev,
+ struct dev_pm_ops *p)
+{
+ return p && p->runtime_suspend ? p->runtime_suspend(dev) : -ENOSYS;
+}
+
+static inline int pm_runtime_ops_resume(struct device *dev,
+ struct dev_pm_ops *p)
+{
+ return p && p->runtime_resume ? p->runtime_resume(dev) : -ENOSYS;
+}
+
+static inline void pm_runtime_ops_idle(struct device *dev,
+ struct dev_pm_ops *p)
+{
+ if (p && p->runtime_idle)
+ p->runtime_idle(dev);
+}
+
#endif
next prev parent reply other threads:[~2009-08-07 7:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-07 7:33 [PATCH 00/05] PM: Runtime PM v13 for Platform Devices 20090807 Magnus Damm
2009-08-07 7:33 ` Magnus Damm [this message]
2009-08-07 7:33 ` [PATCH 02/05] PM: Runtime PM v13 - let bus-less devices succeed Magnus Damm
2009-08-07 7:33 ` [PATCH 03/05] PM: Runtime PM v13 - add debug printouts Magnus Damm
2009-08-08 13:28 ` Rafael J. Wysocki
2009-08-07 7:33 ` [PATCH 04/05] PM: Runtime PM v13 - CONFIG_PM_SLEEP=n support Magnus Damm
2009-08-07 7:34 ` [PATCH 05/05] PM: Runtime PM v13 - platform device bus support Magnus Damm
2009-08-07 14:32 ` [PATCH 00/05] PM: Runtime PM v13 for Platform Devices 20090807 Alan Stern
2009-08-07 15:42 ` Magnus Damm
2009-08-07 16:17 ` Alan Stern
2009-08-08 13:47 ` Rafael J. Wysocki
2009-08-10 10:57 ` Magnus Damm
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=20090807073325.22479.31226.sendpatchset@rx1.opensource.se \
--to=magnus.damm@gmail.com \
--cc=gregkh@suse.de \
--cc=linux-pm@lists.linux-foundation.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