aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pm_runtime.h
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2010-09-25 17:34:54 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2010-10-16 19:57:44 -0400
commit3f9af0513ae5b1f185302c2d0ba656640926d970 (patch)
tree5f99b98aca875a812f444721a88a3fc3de842538 /include/linux/pm_runtime.h
parent4769373ca2c8d0b999749a070c48fd8648888831 (diff)
PM / Runtime: Replace boolean arguments with bitflags
The "from_wq" argument in __pm_runtime_suspend() and __pm_runtime_resume() supposedly indicates whether or not the function was called by the PM workqueue thread, but in fact it isn't always used this way. It really indicates whether or not the function should return early if the requested operation is already in progress. Along with this badly-named boolean argument, later patches in this series will add several other boolean arguments to these functions and others. Therefore this patch (as1422) begins the conversion process by replacing from_wq with a bitflag argument. The same bitflags are also used in __pm_runtime_get() and __pm_runtime_put(), where they indicate whether or not the operation should be asynchronous. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'include/linux/pm_runtime.h')
-rw-r--r--include/linux/pm_runtime.h23
1 files changed, 15 insertions, 8 deletions
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index 6e81888c6222..c030cac59aac 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -12,6 +12,11 @@
12#include <linux/device.h> 12#include <linux/device.h>
13#include <linux/pm.h> 13#include <linux/pm.h>
14 14
15/* Runtime PM flag argument bits */
16#define RPM_ASYNC 0x01 /* Request is asynchronous */
17#define RPM_NOWAIT 0x02 /* Don't wait for concurrent
18 state change */
19
15#ifdef CONFIG_PM_RUNTIME 20#ifdef CONFIG_PM_RUNTIME
16 21
17extern struct workqueue_struct *pm_wq; 22extern struct workqueue_struct *pm_wq;
@@ -22,8 +27,8 @@ extern int pm_runtime_resume(struct device *dev);
22extern int pm_request_idle(struct device *dev); 27extern int pm_request_idle(struct device *dev);
23extern int pm_schedule_suspend(struct device *dev, unsigned int delay); 28extern int pm_schedule_suspend(struct device *dev, unsigned int delay);
24extern int pm_request_resume(struct device *dev); 29extern int pm_request_resume(struct device *dev);
25extern int __pm_runtime_get(struct device *dev, bool sync); 30extern int __pm_runtime_get(struct device *dev, int rpmflags);
26extern int __pm_runtime_put(struct device *dev, bool sync); 31extern int __pm_runtime_put(struct device *dev, int rpmflags);
27extern int __pm_runtime_set_status(struct device *dev, unsigned int status); 32extern int __pm_runtime_set_status(struct device *dev, unsigned int status);
28extern int pm_runtime_barrier(struct device *dev); 33extern int pm_runtime_barrier(struct device *dev);
29extern void pm_runtime_enable(struct device *dev); 34extern void pm_runtime_enable(struct device *dev);
@@ -81,8 +86,10 @@ static inline int pm_schedule_suspend(struct device *dev, unsigned int delay)
81 return -ENOSYS; 86 return -ENOSYS;
82} 87}
83static inline int pm_request_resume(struct device *dev) { return 0; } 88static inline int pm_request_resume(struct device *dev) { return 0; }
84static inline int __pm_runtime_get(struct device *dev, bool sync) { return 1; } 89static inline int __pm_runtime_get(struct device *dev, int rpmflags)
85static inline int __pm_runtime_put(struct device *dev, bool sync) { return 0; } 90 { return 1; }
91static inline int __pm_runtime_put(struct device *dev, int rpmflags)
92 { return 0; }
86static inline int __pm_runtime_set_status(struct device *dev, 93static inline int __pm_runtime_set_status(struct device *dev,
87 unsigned int status) { return 0; } 94 unsigned int status) { return 0; }
88static inline int pm_runtime_barrier(struct device *dev) { return 0; } 95static inline int pm_runtime_barrier(struct device *dev) { return 0; }
@@ -107,22 +114,22 @@ static inline int pm_generic_runtime_resume(struct device *dev) { return 0; }
107 114
108static inline int pm_runtime_get(struct device *dev) 115static inline int pm_runtime_get(struct device *dev)
109{ 116{
110 return __pm_runtime_get(dev, false); 117 return __pm_runtime_get(dev, RPM_ASYNC);
111} 118}
112 119
113static inline int pm_runtime_get_sync(struct device *dev) 120static inline int pm_runtime_get_sync(struct device *dev)
114{ 121{
115 return __pm_runtime_get(dev, true); 122 return __pm_runtime_get(dev, 0);
116} 123}
117 124
118static inline int pm_runtime_put(struct device *dev) 125static inline int pm_runtime_put(struct device *dev)
119{ 126{
120 return __pm_runtime_put(dev, false); 127 return __pm_runtime_put(dev, RPM_ASYNC);
121} 128}
122 129
123static inline int pm_runtime_put_sync(struct device *dev) 130static inline int pm_runtime_put_sync(struct device *dev)
124{ 131{
125 return __pm_runtime_put(dev, true); 132 return __pm_runtime_put(dev, 0);
126} 133}
127 134
128static inline int pm_runtime_set_active(struct device *dev) 135static inline int pm_runtime_set_active(struct device *dev)