diff options
Diffstat (limited to 'drivers/base/power/power.h')
-rw-r--r-- | drivers/base/power/power.h | 22 |
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 | ||
3 | static 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 | ||
5 | extern void pm_runtime_init(struct device *dev); | 11 | extern 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 | ||
28 | extern void device_pm_init(struct device *dev); | 34 | extern void device_pm_sleep_init(struct device *dev); |
29 | extern void device_pm_add(struct device *); | 35 | extern void device_pm_add(struct device *); |
30 | extern void device_pm_remove(struct device *); | 36 | extern void device_pm_remove(struct device *); |
31 | extern void device_pm_move_before(struct device *, struct device *); | 37 | extern 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 | ||
37 | static inline void device_pm_init(struct device *dev) | 43 | static 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 | ||
44 | static inline void device_pm_add(struct device *dev) | 45 | static 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 | ||
64 | static 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 | /* |