diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2010-09-25 17:34:54 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2010-10-16 19:57:44 -0400 |
commit | 3f9af0513ae5b1f185302c2d0ba656640926d970 (patch) | |
tree | 5f99b98aca875a812f444721a88a3fc3de842538 /include/linux/pm_runtime.h | |
parent | 4769373ca2c8d0b999749a070c48fd8648888831 (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.h | 23 |
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 | ||
17 | extern struct workqueue_struct *pm_wq; | 22 | extern struct workqueue_struct *pm_wq; |
@@ -22,8 +27,8 @@ extern int pm_runtime_resume(struct device *dev); | |||
22 | extern int pm_request_idle(struct device *dev); | 27 | extern int pm_request_idle(struct device *dev); |
23 | extern int pm_schedule_suspend(struct device *dev, unsigned int delay); | 28 | extern int pm_schedule_suspend(struct device *dev, unsigned int delay); |
24 | extern int pm_request_resume(struct device *dev); | 29 | extern int pm_request_resume(struct device *dev); |
25 | extern int __pm_runtime_get(struct device *dev, bool sync); | 30 | extern int __pm_runtime_get(struct device *dev, int rpmflags); |
26 | extern int __pm_runtime_put(struct device *dev, bool sync); | 31 | extern int __pm_runtime_put(struct device *dev, int rpmflags); |
27 | extern int __pm_runtime_set_status(struct device *dev, unsigned int status); | 32 | extern int __pm_runtime_set_status(struct device *dev, unsigned int status); |
28 | extern int pm_runtime_barrier(struct device *dev); | 33 | extern int pm_runtime_barrier(struct device *dev); |
29 | extern void pm_runtime_enable(struct device *dev); | 34 | extern 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 | } |
83 | static inline int pm_request_resume(struct device *dev) { return 0; } | 88 | static inline int pm_request_resume(struct device *dev) { return 0; } |
84 | static inline int __pm_runtime_get(struct device *dev, bool sync) { return 1; } | 89 | static inline int __pm_runtime_get(struct device *dev, int rpmflags) |
85 | static inline int __pm_runtime_put(struct device *dev, bool sync) { return 0; } | 90 | { return 1; } |
91 | static inline int __pm_runtime_put(struct device *dev, int rpmflags) | ||
92 | { return 0; } | ||
86 | static inline int __pm_runtime_set_status(struct device *dev, | 93 | static inline int __pm_runtime_set_status(struct device *dev, |
87 | unsigned int status) { return 0; } | 94 | unsigned int status) { return 0; } |
88 | static inline int pm_runtime_barrier(struct device *dev) { return 0; } | 95 | static 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 | ||
108 | static inline int pm_runtime_get(struct device *dev) | 115 | static 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 | ||
113 | static inline int pm_runtime_get_sync(struct device *dev) | 120 | static 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 | ||
118 | static inline int pm_runtime_put(struct device *dev) | 125 | static 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 | ||
123 | static inline int pm_runtime_put_sync(struct device *dev) | 130 | static 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 | ||
128 | static inline int pm_runtime_set_active(struct device *dev) | 135 | static inline int pm_runtime_set_active(struct device *dev) |