diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2010-09-25 17:35:07 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2010-10-16 19:57:47 -0400 |
commit | 140a6c945211ee911dec776fafa52e03a7d7bb9a (patch) | |
tree | 22b5d4bf530d95a890daef41d92051fca043ca26 /include/linux/pm_runtime.h | |
parent | 1bfee5bc86fdaecc912e06080583eddab7263df2 (diff) |
PM / Runtime: Combine runtime PM entry points
This patch (as1424) combines the various public entry points for the
runtime PM routines into three simple functions: one for idle, one for
suspend, and one for resume. A new bitflag specifies whether or not
to increment or decrement the usage_count field.
The new entry points are named __pm_runtime_idle,
__pm_runtime_suspend, and __pm_runtime_resume, to reflect that they
are trampolines. Simultaneously, the corresponding internal routines
are renamed to rpm_idle, rpm_suspend, and rpm_resume.
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 | 66 |
1 files changed, 46 insertions, 20 deletions
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h index c030cac59aac..5869d87fffac 100644 --- a/include/linux/pm_runtime.h +++ b/include/linux/pm_runtime.h | |||
@@ -16,19 +16,17 @@ | |||
16 | #define RPM_ASYNC 0x01 /* Request is asynchronous */ | 16 | #define RPM_ASYNC 0x01 /* Request is asynchronous */ |
17 | #define RPM_NOWAIT 0x02 /* Don't wait for concurrent | 17 | #define RPM_NOWAIT 0x02 /* Don't wait for concurrent |
18 | state change */ | 18 | state change */ |
19 | #define RPM_GET_PUT 0x04 /* Increment/decrement the | ||
20 | usage_count */ | ||
19 | 21 | ||
20 | #ifdef CONFIG_PM_RUNTIME | 22 | #ifdef CONFIG_PM_RUNTIME |
21 | 23 | ||
22 | extern struct workqueue_struct *pm_wq; | 24 | extern struct workqueue_struct *pm_wq; |
23 | 25 | ||
24 | extern int pm_runtime_idle(struct device *dev); | 26 | extern int __pm_runtime_idle(struct device *dev, int rpmflags); |
25 | extern int pm_runtime_suspend(struct device *dev); | 27 | extern int __pm_runtime_suspend(struct device *dev, int rpmflags); |
26 | extern int pm_runtime_resume(struct device *dev); | 28 | extern int __pm_runtime_resume(struct device *dev, int rpmflags); |
27 | extern int pm_request_idle(struct device *dev); | ||
28 | extern int pm_schedule_suspend(struct device *dev, unsigned int delay); | 29 | extern int pm_schedule_suspend(struct device *dev, unsigned int delay); |
29 | extern int pm_request_resume(struct device *dev); | ||
30 | extern int __pm_runtime_get(struct device *dev, int rpmflags); | ||
31 | extern int __pm_runtime_put(struct device *dev, int rpmflags); | ||
32 | extern int __pm_runtime_set_status(struct device *dev, unsigned int status); | 30 | extern int __pm_runtime_set_status(struct device *dev, unsigned int status); |
33 | extern int pm_runtime_barrier(struct device *dev); | 31 | extern int pm_runtime_barrier(struct device *dev); |
34 | extern void pm_runtime_enable(struct device *dev); | 32 | extern void pm_runtime_enable(struct device *dev); |
@@ -77,19 +75,22 @@ static inline bool pm_runtime_suspended(struct device *dev) | |||
77 | 75 | ||
78 | #else /* !CONFIG_PM_RUNTIME */ | 76 | #else /* !CONFIG_PM_RUNTIME */ |
79 | 77 | ||
80 | static inline int pm_runtime_idle(struct device *dev) { return -ENOSYS; } | 78 | static inline int __pm_runtime_idle(struct device *dev, int rpmflags) |
81 | static inline int pm_runtime_suspend(struct device *dev) { return -ENOSYS; } | 79 | { |
82 | static inline int pm_runtime_resume(struct device *dev) { return 0; } | 80 | return -ENOSYS; |
83 | static inline int pm_request_idle(struct device *dev) { return -ENOSYS; } | 81 | } |
82 | static inline int __pm_runtime_suspend(struct device *dev, int rpmflags) | ||
83 | { | ||
84 | return -ENOSYS; | ||
85 | } | ||
86 | static inline int __pm_runtime_resume(struct device *dev, int rpmflags) | ||
87 | { | ||
88 | return 1; | ||
89 | } | ||
84 | static inline int pm_schedule_suspend(struct device *dev, unsigned int delay) | 90 | static inline int pm_schedule_suspend(struct device *dev, unsigned int delay) |
85 | { | 91 | { |
86 | return -ENOSYS; | 92 | return -ENOSYS; |
87 | } | 93 | } |
88 | static inline int pm_request_resume(struct device *dev) { return 0; } | ||
89 | static inline int __pm_runtime_get(struct device *dev, int rpmflags) | ||
90 | { return 1; } | ||
91 | static inline int __pm_runtime_put(struct device *dev, int rpmflags) | ||
92 | { return 0; } | ||
93 | static inline int __pm_runtime_set_status(struct device *dev, | 94 | static inline int __pm_runtime_set_status(struct device *dev, |
94 | unsigned int status) { return 0; } | 95 | unsigned int status) { return 0; } |
95 | static inline int pm_runtime_barrier(struct device *dev) { return 0; } | 96 | static inline int pm_runtime_barrier(struct device *dev) { return 0; } |
@@ -112,24 +113,49 @@ static inline int pm_generic_runtime_resume(struct device *dev) { return 0; } | |||
112 | 113 | ||
113 | #endif /* !CONFIG_PM_RUNTIME */ | 114 | #endif /* !CONFIG_PM_RUNTIME */ |
114 | 115 | ||
116 | static inline int pm_runtime_idle(struct device *dev) | ||
117 | { | ||
118 | return __pm_runtime_idle(dev, 0); | ||
119 | } | ||
120 | |||
121 | static inline int pm_runtime_suspend(struct device *dev) | ||
122 | { | ||
123 | return __pm_runtime_suspend(dev, 0); | ||
124 | } | ||
125 | |||
126 | static inline int pm_runtime_resume(struct device *dev) | ||
127 | { | ||
128 | return __pm_runtime_resume(dev, 0); | ||
129 | } | ||
130 | |||
131 | static inline int pm_request_idle(struct device *dev) | ||
132 | { | ||
133 | return __pm_runtime_idle(dev, RPM_ASYNC); | ||
134 | } | ||
135 | |||
136 | static inline int pm_request_resume(struct device *dev) | ||
137 | { | ||
138 | return __pm_runtime_resume(dev, RPM_ASYNC); | ||
139 | } | ||
140 | |||
115 | static inline int pm_runtime_get(struct device *dev) | 141 | static inline int pm_runtime_get(struct device *dev) |
116 | { | 142 | { |
117 | return __pm_runtime_get(dev, RPM_ASYNC); | 143 | return __pm_runtime_resume(dev, RPM_GET_PUT | RPM_ASYNC); |
118 | } | 144 | } |
119 | 145 | ||
120 | static inline int pm_runtime_get_sync(struct device *dev) | 146 | static inline int pm_runtime_get_sync(struct device *dev) |
121 | { | 147 | { |
122 | return __pm_runtime_get(dev, 0); | 148 | return __pm_runtime_resume(dev, RPM_GET_PUT); |
123 | } | 149 | } |
124 | 150 | ||
125 | static inline int pm_runtime_put(struct device *dev) | 151 | static inline int pm_runtime_put(struct device *dev) |
126 | { | 152 | { |
127 | return __pm_runtime_put(dev, RPM_ASYNC); | 153 | return __pm_runtime_idle(dev, RPM_GET_PUT | RPM_ASYNC); |
128 | } | 154 | } |
129 | 155 | ||
130 | static inline int pm_runtime_put_sync(struct device *dev) | 156 | static inline int pm_runtime_put_sync(struct device *dev) |
131 | { | 157 | { |
132 | return __pm_runtime_put(dev, 0); | 158 | return __pm_runtime_idle(dev, RPM_GET_PUT); |
133 | } | 159 | } |
134 | 160 | ||
135 | static inline int pm_runtime_set_active(struct device *dev) | 161 | static inline int pm_runtime_set_active(struct device *dev) |