aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/power/power.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/power/power.h')
-rw-r--r--drivers/base/power/power.h22
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/base/power/power.h b/drivers/base/power/power.h
index eeb4bff9505c..8a0dcc7f98f9 100644
--- a/drivers/base/power/power.h
+++ b/drivers/base/power/power.h
@@ -1,5 +1,11 @@
1#include <linux/pm_qos.h> 1#include <linux/pm_qos.h>
2 2
3static inline void device_pm_init_common(struct device *dev)
4{
5 spin_lock_init(&dev->power.lock);
6 dev->power.power_state = PMSG_INVALID;
7}
8
3#ifdef CONFIG_PM_RUNTIME 9#ifdef CONFIG_PM_RUNTIME
4 10
5extern void pm_runtime_init(struct device *dev); 11extern void pm_runtime_init(struct device *dev);
@@ -25,7 +31,7 @@ static inline struct device *to_device(struct list_head *entry)
25 return container_of(entry, struct device, power.entry); 31 return container_of(entry, struct device, power.entry);
26} 32}
27 33
28extern void device_pm_init(struct device *dev); 34extern void device_pm_sleep_init(struct device *dev);
29extern void device_pm_add(struct device *); 35extern void device_pm_add(struct device *);
30extern void device_pm_remove(struct device *); 36extern void device_pm_remove(struct device *);
31extern void device_pm_move_before(struct device *, struct device *); 37extern void device_pm_move_before(struct device *, struct device *);
@@ -34,12 +40,7 @@ extern void device_pm_move_last(struct device *);
34 40
35#else /* !CONFIG_PM_SLEEP */ 41#else /* !CONFIG_PM_SLEEP */
36 42
37static inline void device_pm_init(struct device *dev) 43static inline void device_pm_sleep_init(struct device *dev) {}
38{
39 spin_lock_init(&dev->power.lock);
40 dev->power.power_state = PMSG_INVALID;
41 pm_runtime_init(dev);
42}
43 44
44static inline void device_pm_add(struct device *dev) 45static inline void device_pm_add(struct device *dev)
45{ 46{
@@ -60,6 +61,13 @@ static inline void device_pm_move_last(struct device *dev) {}
60 61
61#endif /* !CONFIG_PM_SLEEP */ 62#endif /* !CONFIG_PM_SLEEP */
62 63
64static inline void device_pm_init(struct device *dev)
65{
66 device_pm_init_common(dev);
67 device_pm_sleep_init(dev);
68 pm_runtime_init(dev);
69}
70
63#ifdef CONFIG_PM 71#ifdef CONFIG_PM
64 72
65/* 73/*