From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: linux-sh@vger.kernel.org
Cc: Linux PM mailing list <linux-pm@lists.linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>,
Magnus Damm <magnus.damm@gmail.com>
Subject: [PATCH 1/2] PM / Runtime: Introduce pm_runtime_irq_unsafe()
Date: Sat, 20 Aug 2011 19:32:13 +0000 [thread overview]
Message-ID: <201108202132.13304.rjw@sisk.pl> (raw)
In-Reply-To: <201108202131.19479.rjw@sisk.pl>
From: Rafael J. Wysocki <rjw@sisk.pl>
Add a helper function allowing drivers and subsystems to clear
the power.irq_safe device flag.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
Documentation/power/runtime_pm.txt | 4 ++++
drivers/base/power/runtime.c | 9 +++++----
include/linux/pm_runtime.h | 13 ++++++++++++-
3 files changed, 21 insertions(+), 5 deletions(-)
Index: linux/include/linux/pm_runtime.h
=================================--- linux.orig/include/linux/pm_runtime.h
+++ linux/include/linux/pm_runtime.h
@@ -40,7 +40,7 @@ extern int pm_generic_runtime_idle(struc
extern int pm_generic_runtime_suspend(struct device *dev);
extern int pm_generic_runtime_resume(struct device *dev);
extern void pm_runtime_no_callbacks(struct device *dev);
-extern void pm_runtime_irq_safe(struct device *dev);
+extern void __pm_runtime_irq_safe(struct device *dev, bool irq_safe);
extern void __pm_runtime_use_autosuspend(struct device *dev, bool use);
extern void pm_runtime_set_autosuspend_delay(struct device *dev, int delay);
extern unsigned long pm_runtime_autosuspend_expiration(struct device *dev);
@@ -102,6 +102,16 @@ static inline void pm_runtime_mark_last_
ACCESS_ONCE(dev->power.last_busy) = jiffies;
}
+static inline void pm_runtime_irq_safe(struct device *dev)
+{
+ __pm_runtime_irq_safe(dev, true);
+}
+
+static inline void pm_runtime_irq_unsafe(struct device *dev)
+{
+ __pm_runtime_irq_safe(dev, false);
+}
+
#else /* !CONFIG_PM_RUNTIME */
static inline int __pm_runtime_idle(struct device *dev, int rpmflags)
@@ -143,6 +153,7 @@ static inline int pm_generic_runtime_sus
static inline int pm_generic_runtime_resume(struct device *dev) { return 0; }
static inline void pm_runtime_no_callbacks(struct device *dev) {}
static inline void pm_runtime_irq_safe(struct device *dev) {}
+static inline void pm_runtime_irq_unsafe(struct device *dev) {}
static inline bool pm_runtime_callbacks_present(struct device *dev) { return false; }
static inline void pm_runtime_mark_last_busy(struct device *dev) {}
Index: linux/drivers/base/power/runtime.c
=================================--- linux.orig/drivers/base/power/runtime.c
+++ linux/drivers/base/power/runtime.c
@@ -1109,22 +1109,23 @@ void pm_runtime_no_callbacks(struct devi
EXPORT_SYMBOL_GPL(pm_runtime_no_callbacks);
/**
- * pm_runtime_irq_safe - Leave interrupts disabled during callbacks.
+ * __pm_runtime_irq_safe - Manipulate a device's power.irq_safe flag.
* @dev: Device to handle
+ * @irq_safe: Whether or not to leave interrupts disabled during callbacks.
*
- * Set the power.irq_safe flag, which tells the PM core that the
+ * Set or unset the power.irq_safe flag, which tells the PM core that the
* ->runtime_suspend() and ->runtime_resume() callbacks for this device should
* always be invoked with the spinlock held and interrupts disabled. It also
* causes the parent's usage counter to be permanently incremented, preventing
* the parent from runtime suspending -- otherwise an irq-safe child might have
* to wait for a non-irq-safe parent.
*/
-void pm_runtime_irq_safe(struct device *dev)
+void __pm_runtime_irq_safe(struct device *dev, bool irq_safe)
{
if (dev->parent)
pm_runtime_get_sync(dev->parent);
spin_lock_irq(&dev->power.lock);
- dev->power.irq_safe = 1;
+ dev->power.irq_safe = irq_safe;
spin_unlock_irq(&dev->power.lock);
}
EXPORT_SYMBOL_GPL(pm_runtime_irq_safe);
Index: linux/Documentation/power/runtime_pm.txt
=================================--- linux.orig/Documentation/power/runtime_pm.txt
+++ linux/Documentation/power/runtime_pm.txt
@@ -434,6 +434,10 @@ drivers/base/power/runtime.c and include
suspend and resume callbacks (but not the idle callback) to be invoked
with interrupts disabled
+ void pm_runtime_irq_unsafe(struct device *dev);
+ - clear the power.irq_safe flag for the device, causing the runtime-PM
+ callbacks to be invoked with interrupts enabled
+
void pm_runtime_mark_last_busy(struct device *dev);
- set the power.last_busy field to the current time
next prev parent reply other threads:[~2011-08-20 19:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-20 19:31 [PATCH 0/2] sh-sci / PM: Fix problem with runtime PM callbacks run with interrupts off Rafael J. Wysocki
2011-08-20 19:32 ` Rafael J. Wysocki [this message]
2011-08-21 14:55 ` [linux-pm] [PATCH 1/2] PM / Runtime: Introduce pm_runtime_irq_unsafe() Alan Stern
2011-08-21 18:09 ` Rafael J. Wysocki
2011-08-20 19:33 ` [PATCH 2/2] sh-sci / PM: Use power.irq_safe Rafael J. Wysocki
2011-08-21 19:09 ` [PATCH 0/2 v2] sh-sci / PM: Fix problem with runtime PM callbacks run with interrupts off Rafael J. Wysocki
2011-08-21 19:10 ` [PATCH 1/2 v2] PM: Change PM subsys_data lock type into spinlock Rafael J. Wysocki
2011-08-22 6:18 ` [Replacement][PATCH 1/2 v2] PM: Use spinlock instead of mutex in clock management functions Rafael J. Wysocki
2011-08-21 19:11 ` [PATCH 2/2 v2] sh-sci / PM: Use power.irq_safe Rafael J. Wysocki
2011-08-24 5:33 ` Paul Mundt
2011-08-24 20:52 ` Rafael J. Wysocki
2011-08-25 1:33 ` Paul Mundt
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=201108202132.13304.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=linux-sh@vger.kernel.org \
--cc=magnus.damm@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