aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2010-11-30 18:14:42 -0500
committerRafael J. Wysocki <rjw@sisk.pl>2010-12-24 09:02:41 -0500
commitc7b61de5b7b17f0df34dc7d2f8b9576f8bd36fce (patch)
treed8cf6be1aab175839973d2c76060bd41d65b2ed5 /include/linux
parent5262a47502adcfc3a64403120768f528418a3b79 (diff)
PM / Runtime: Add synchronous runtime interface for interrupt handlers (v3)
This patch (as1431c) makes the synchronous runtime-PM interface suitable for use in interrupt handlers. Subsystems can call the new pm_runtime_irq_safe() function to tell the PM core that a device's runtime_suspend and runtime_resume callbacks should be invoked with interrupts disabled and the spinlock held. This permits the pm_runtime_get_sync() and the new pm_runtime_put_sync_suspend() routines to be called from within interrupt handlers. When a device is declared irq-safe in this way, the PM core increments the parent's usage count, so the parent will never be runtime suspended. This prevents difficult situations in which an irq-safe device can't resume because it is forced to wait for its non-irq-safe parent. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/pm.h1
-rw-r--r--include/linux/pm_runtime.h7
2 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 40f3f45702ba..61f2066e6852 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -486,6 +486,7 @@ struct dev_pm_info {
486 unsigned int run_wake:1; 486 unsigned int run_wake:1;
487 unsigned int runtime_auto:1; 487 unsigned int runtime_auto:1;
488 unsigned int no_callbacks:1; 488 unsigned int no_callbacks:1;
489 unsigned int irq_safe:1;
489 unsigned int use_autosuspend:1; 490 unsigned int use_autosuspend:1;
490 unsigned int timer_autosuspends:1; 491 unsigned int timer_autosuspends:1;
491 enum rpm_request request; 492 enum rpm_request request;
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index d19f1cca7f74..e9cc049ccb62 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -40,6 +40,7 @@ extern int pm_generic_runtime_idle(struct device *dev);
40extern int pm_generic_runtime_suspend(struct device *dev); 40extern int pm_generic_runtime_suspend(struct device *dev);
41extern int pm_generic_runtime_resume(struct device *dev); 41extern int pm_generic_runtime_resume(struct device *dev);
42extern void pm_runtime_no_callbacks(struct device *dev); 42extern void pm_runtime_no_callbacks(struct device *dev);
43extern void pm_runtime_irq_safe(struct device *dev);
43extern void __pm_runtime_use_autosuspend(struct device *dev, bool use); 44extern void __pm_runtime_use_autosuspend(struct device *dev, bool use);
44extern void pm_runtime_set_autosuspend_delay(struct device *dev, int delay); 45extern void pm_runtime_set_autosuspend_delay(struct device *dev, int delay);
45extern unsigned long pm_runtime_autosuspend_expiration(struct device *dev); 46extern unsigned long pm_runtime_autosuspend_expiration(struct device *dev);
@@ -124,6 +125,7 @@ static inline int pm_generic_runtime_idle(struct device *dev) { return 0; }
124static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; } 125static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; }
125static inline int pm_generic_runtime_resume(struct device *dev) { return 0; } 126static inline int pm_generic_runtime_resume(struct device *dev) { return 0; }
126static inline void pm_runtime_no_callbacks(struct device *dev) {} 127static inline void pm_runtime_no_callbacks(struct device *dev) {}
128static inline void pm_runtime_irq_safe(struct device *dev) {}
127 129
128static inline void pm_runtime_mark_last_busy(struct device *dev) {} 130static inline void pm_runtime_mark_last_busy(struct device *dev) {}
129static inline void __pm_runtime_use_autosuspend(struct device *dev, 131static inline void __pm_runtime_use_autosuspend(struct device *dev,
@@ -196,6 +198,11 @@ static inline int pm_runtime_put_sync(struct device *dev)
196 return __pm_runtime_idle(dev, RPM_GET_PUT); 198 return __pm_runtime_idle(dev, RPM_GET_PUT);
197} 199}
198 200
201static inline int pm_runtime_put_sync_suspend(struct device *dev)
202{
203 return __pm_runtime_suspend(dev, RPM_GET_PUT);
204}
205
199static inline int pm_runtime_put_sync_autosuspend(struct device *dev) 206static inline int pm_runtime_put_sync_autosuspend(struct device *dev)
200{ 207{
201 return __pm_runtime_suspend(dev, RPM_GET_PUT | RPM_AUTO); 208 return __pm_runtime_suspend(dev, RPM_GET_PUT | RPM_AUTO);