Commit | Line | Data |
---|---|---|
1a9a9152 RW |
1 | #include <linux/pm_qos.h> |
2 | ||
5e928f77 RW |
3 | #ifdef CONFIG_PM_RUNTIME |
4 | ||
5 | extern void pm_runtime_init(struct device *dev); | |
6 | extern void pm_runtime_remove(struct device *dev); | |
7 | ||
8 | #else /* !CONFIG_PM_RUNTIME */ | |
9 | ||
10 | static inline void pm_runtime_init(struct device *dev) {} | |
11 | static inline void pm_runtime_remove(struct device *dev) {} | |
12 | ||
13 | #endif /* !CONFIG_PM_RUNTIME */ | |
3b98aeaf | 14 | |
296699de | 15 | #ifdef CONFIG_PM_SLEEP |
1da177e4 | 16 | |
0e06b4a8 RW |
17 | /* kernel/power/main.c */ |
18 | extern int pm_async_enabled; | |
1da177e4 | 19 | |
0e06b4a8 | 20 | /* drivers/base/power/main.c */ |
1eede070 | 21 | extern struct list_head dpm_list; /* The active device list */ |
1da177e4 | 22 | |
dec13c15 | 23 | static inline struct device *to_device(struct list_head *entry) |
1da177e4 | 24 | { |
cd59abfc | 25 | return container_of(entry, struct device, power.entry); |
1da177e4 LT |
26 | } |
27 | ||
5e928f77 | 28 | extern void device_pm_init(struct device *dev); |
3b98aeaf | 29 | extern void device_pm_add(struct device *); |
1da177e4 | 30 | extern void device_pm_remove(struct device *); |
ffa6a705 CH |
31 | extern void device_pm_move_before(struct device *, struct device *); |
32 | extern void device_pm_move_after(struct device *, struct device *); | |
33 | extern void device_pm_move_last(struct device *); | |
1da177e4 | 34 | |
5e928f77 RW |
35 | #else /* !CONFIG_PM_SLEEP */ |
36 | ||
37 | static inline void device_pm_init(struct device *dev) | |
38 | { | |
074037ec | 39 | spin_lock_init(&dev->power.lock); |
1a9a9152 | 40 | dev->power.power_state = PMSG_INVALID; |
5e928f77 RW |
41 | pm_runtime_init(dev); |
42 | } | |
43 | ||
1a9a9152 RW |
44 | static inline void device_pm_add(struct device *dev) |
45 | { | |
46 | dev_pm_qos_constraints_init(dev); | |
47 | } | |
48 | ||
5e928f77 RW |
49 | static inline void device_pm_remove(struct device *dev) |
50 | { | |
1a9a9152 | 51 | dev_pm_qos_constraints_destroy(dev); |
5e928f77 RW |
52 | pm_runtime_remove(dev); |
53 | } | |
dec13c15 | 54 | |
ffa6a705 CH |
55 | static inline void device_pm_move_before(struct device *deva, |
56 | struct device *devb) {} | |
57 | static inline void device_pm_move_after(struct device *deva, | |
58 | struct device *devb) {} | |
59 | static inline void device_pm_move_last(struct device *dev) {} | |
775b64d2 | 60 | |
5e928f77 | 61 | #endif /* !CONFIG_PM_SLEEP */ |
dec13c15 DD |
62 | |
63 | #ifdef CONFIG_PM | |
64 | ||
1da177e4 LT |
65 | /* |
66 | * sysfs.c | |
67 | */ | |
68 | ||
cb8f51bd RW |
69 | extern int dpm_sysfs_add(struct device *dev); |
70 | extern void dpm_sysfs_remove(struct device *dev); | |
71 | extern void rpm_sysfs_remove(struct device *dev); | |
72 | extern int wakeup_sysfs_add(struct device *dev); | |
73 | extern void wakeup_sysfs_remove(struct device *dev); | |
85dc0b8a RW |
74 | extern int pm_qos_sysfs_add(struct device *dev); |
75 | extern void pm_qos_sysfs_remove(struct device *dev); | |
1da177e4 | 76 | |
dec13c15 | 77 | #else /* CONFIG_PM */ |
1da177e4 | 78 | |
cb8f51bd RW |
79 | static inline int dpm_sysfs_add(struct device *dev) { return 0; } |
80 | static inline void dpm_sysfs_remove(struct device *dev) {} | |
81 | static inline void rpm_sysfs_remove(struct device *dev) {} | |
82 | static inline int wakeup_sysfs_add(struct device *dev) { return 0; } | |
83 | static inline void wakeup_sysfs_remove(struct device *dev) {} | |
85dc0b8a RW |
84 | static inline int pm_qos_sysfs_add(struct device *dev) { return 0; } |
85 | static inline void pm_qos_sysfs_remove(struct device *dev) {} | |
1da177e4 | 86 | |
1da177e4 | 87 | #endif |