aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pm_wakeup.h
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2012-02-21 17:47:56 -0500
committerRafael J. Wysocki <rjw@sisk.pl>2012-03-04 17:08:46 -0500
commit8671bbc1bd0442ef0eab27f7d56216431c490820 (patch)
tree23bc127d43be672ab82b9602e21825522d62a28a /include/linux/pm_wakeup.h
parent05b4877f6a4f1ba4952d1222213d262bf8c132b7 (diff)
PM / Sleep: Add more wakeup source initialization routines
The existing wakeup source initialization routines are not particularly useful for wakeup sources that aren't created by wakeup_source_create(), because their users have to open code filling the objects with zeros and setting their names. For this reason, introduce routines that can be used for initializing, for example, static wakeup source objects. Requested-by: Arve Hjønnevåg <arve@android.com> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'include/linux/pm_wakeup.h')
-rw-r--r--include/linux/pm_wakeup.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h
index a32da962d693..d9f05113e5fb 100644
--- a/include/linux/pm_wakeup.h
+++ b/include/linux/pm_wakeup.h
@@ -41,7 +41,7 @@
41 * @active: Status of the wakeup source. 41 * @active: Status of the wakeup source.
42 */ 42 */
43struct wakeup_source { 43struct wakeup_source {
44 char *name; 44 const char *name;
45 struct list_head entry; 45 struct list_head entry;
46 spinlock_t lock; 46 spinlock_t lock;
47 struct timer_list timer; 47 struct timer_list timer;
@@ -73,7 +73,9 @@ static inline bool device_may_wakeup(struct device *dev)
73} 73}
74 74
75/* drivers/base/power/wakeup.c */ 75/* drivers/base/power/wakeup.c */
76extern void wakeup_source_prepare(struct wakeup_source *ws, const char *name);
76extern struct wakeup_source *wakeup_source_create(const char *name); 77extern struct wakeup_source *wakeup_source_create(const char *name);
78extern void wakeup_source_drop(struct wakeup_source *ws);
77extern void wakeup_source_destroy(struct wakeup_source *ws); 79extern void wakeup_source_destroy(struct wakeup_source *ws);
78extern void wakeup_source_add(struct wakeup_source *ws); 80extern void wakeup_source_add(struct wakeup_source *ws);
79extern void wakeup_source_remove(struct wakeup_source *ws); 81extern void wakeup_source_remove(struct wakeup_source *ws);
@@ -103,11 +105,16 @@ static inline bool device_can_wakeup(struct device *dev)
103 return dev->power.can_wakeup; 105 return dev->power.can_wakeup;
104} 106}
105 107
108static inline void wakeup_source_prepare(struct wakeup_source *ws,
109 const char *name) {}
110
106static inline struct wakeup_source *wakeup_source_create(const char *name) 111static inline struct wakeup_source *wakeup_source_create(const char *name)
107{ 112{
108 return NULL; 113 return NULL;
109} 114}
110 115
116static inline void wakeup_source_drop(struct wakeup_source *ws) {}
117
111static inline void wakeup_source_destroy(struct wakeup_source *ws) {} 118static inline void wakeup_source_destroy(struct wakeup_source *ws) {}
112 119
113static inline void wakeup_source_add(struct wakeup_source *ws) {} 120static inline void wakeup_source_add(struct wakeup_source *ws) {}
@@ -165,4 +172,17 @@ static inline void pm_wakeup_event(struct device *dev, unsigned int msec) {}
165 172
166#endif /* !CONFIG_PM_SLEEP */ 173#endif /* !CONFIG_PM_SLEEP */
167 174
175static inline void wakeup_source_init(struct wakeup_source *ws,
176 const char *name)
177{
178 wakeup_source_prepare(ws, name);
179 wakeup_source_add(ws);
180}
181
182static inline void wakeup_source_trash(struct wakeup_source *ws)
183{
184 wakeup_source_remove(ws);
185 wakeup_source_drop(ws);
186}
187
168#endif /* _LINUX_PM_WAKEUP_H */ 188#endif /* _LINUX_PM_WAKEUP_H */