aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pm_runtime.h
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2010-09-25 17:35:07 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2010-10-16 19:57:47 -0400
commit140a6c945211ee911dec776fafa52e03a7d7bb9a (patch)
tree22b5d4bf530d95a890daef41d92051fca043ca26 /include/linux/pm_runtime.h
parent1bfee5bc86fdaecc912e06080583eddab7263df2 (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.h66
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
22extern struct workqueue_struct *pm_wq; 24extern struct workqueue_struct *pm_wq;
23 25
24extern int pm_runtime_idle(struct device *dev); 26extern int __pm_runtime_idle(struct device *dev, int rpmflags);
25extern int pm_runtime_suspend(struct device *dev); 27extern int __pm_runtime_suspend(struct device *dev, int rpmflags);
26extern int pm_runtime_resume(struct device *dev); 28extern int __pm_runtime_resume(struct device *dev, int rpmflags);
27extern int pm_request_idle(struct device *dev);
28extern int pm_schedule_suspend(struct device *dev, unsigned int delay); 29extern int pm_schedule_suspend(struct device *dev, unsigned int delay);
29extern int pm_request_resume(struct device *dev);
30extern int __pm_runtime_get(struct device *dev, int rpmflags);
31extern int __pm_runtime_put(struct device *dev, int rpmflags);
32extern int __pm_runtime_set_status(struct device *dev, unsigned int status); 30extern int __pm_runtime_set_status(struct device *dev, unsigned int status);
33extern int pm_runtime_barrier(struct device *dev); 31extern int pm_runtime_barrier(struct device *dev);
34extern void pm_runtime_enable(struct device *dev); 32extern 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
80static inline int pm_runtime_idle(struct device *dev) { return -ENOSYS; } 78static inline int __pm_runtime_idle(struct device *dev, int rpmflags)
81static inline int pm_runtime_suspend(struct device *dev) { return -ENOSYS; } 79{
82static inline int pm_runtime_resume(struct device *dev) { return 0; } 80 return -ENOSYS;
83static inline int pm_request_idle(struct device *dev) { return -ENOSYS; } 81}
82static inline int __pm_runtime_suspend(struct device *dev, int rpmflags)
83{
84 return -ENOSYS;
85}
86static inline int __pm_runtime_resume(struct device *dev, int rpmflags)
87{
88 return 1;
89}
84static inline int pm_schedule_suspend(struct device *dev, unsigned int delay) 90static inline int pm_schedule_suspend(struct device *dev, unsigned int delay)
85{ 91{
86 return -ENOSYS; 92 return -ENOSYS;
87} 93}
88static inline int pm_request_resume(struct device *dev) { return 0; }
89static inline int __pm_runtime_get(struct device *dev, int rpmflags)
90 { return 1; }
91static inline int __pm_runtime_put(struct device *dev, int rpmflags)
92 { return 0; }
93static inline int __pm_runtime_set_status(struct device *dev, 94static inline int __pm_runtime_set_status(struct device *dev,
94 unsigned int status) { return 0; } 95 unsigned int status) { return 0; }
95static inline int pm_runtime_barrier(struct device *dev) { return 0; } 96static 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
116static inline int pm_runtime_idle(struct device *dev)
117{
118 return __pm_runtime_idle(dev, 0);
119}
120
121static inline int pm_runtime_suspend(struct device *dev)
122{
123 return __pm_runtime_suspend(dev, 0);
124}
125
126static inline int pm_runtime_resume(struct device *dev)
127{
128 return __pm_runtime_resume(dev, 0);
129}
130
131static inline int pm_request_idle(struct device *dev)
132{
133 return __pm_runtime_idle(dev, RPM_ASYNC);
134}
135
136static inline int pm_request_resume(struct device *dev)
137{
138 return __pm_runtime_resume(dev, RPM_ASYNC);
139}
140
115static inline int pm_runtime_get(struct device *dev) 141static 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
120static inline int pm_runtime_get_sync(struct device *dev) 146static 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
125static inline int pm_runtime_put(struct device *dev) 151static 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
130static inline int pm_runtime_put_sync(struct device *dev) 156static 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
135static inline int pm_runtime_set_active(struct device *dev) 161static inline int pm_runtime_set_active(struct device *dev)