1#include <linux/pm_qos.h> 2 3#ifdef CONFIG_PM_RUNTIME 4 5extern void pm_runtime_init(struct device *dev); 6extern void pm_runtime_remove(struct device *dev); 7 8#else /* !CONFIG_PM_RUNTIME */ 9 10static inline void pm_runtime_init(struct device *dev) {} 11static inline void pm_runtime_remove(struct device *dev) {} 12 13#endif /* !CONFIG_PM_RUNTIME */ 14 15#ifdef CONFIG_PM_SLEEP 16 17/* kernel/power/main.c */ 18extern int pm_async_enabled; 19 20/* drivers/base/power/main.c */ 21extern struct list_head dpm_list; /* The active device list */ 22 23static inline struct device *to_device(struct list_head *entry) 24{ 25 return container_of(entry, struct device, power.entry); 26} 27 28extern void device_pm_init(struct device *dev); 29extern void device_pm_add(struct device *); 30extern void device_pm_remove(struct device *); 31extern void device_pm_move_before(struct device *, struct device *); 32extern void device_pm_move_after(struct device *, struct device *); 33extern void device_pm_move_last(struct device *); 34 35#else /* !CONFIG_PM_SLEEP */ 36 37static inline void device_pm_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 44static inline void device_pm_add(struct device *dev) 45{ 46 dev_pm_qos_constraints_init(dev); 47} 48 49static inline void device_pm_remove(struct device *dev) 50{ 51 dev_pm_qos_constraints_destroy(dev); 52 pm_runtime_remove(dev); 53} 54 55static inline void device_pm_move_before(struct device *deva, 56 struct device *devb) {} 57static inline void device_pm_move_after(struct device *deva, 58 struct device *devb) {} 59static inline void device_pm_move_last(struct device *dev) {} 60 61#endif /* !CONFIG_PM_SLEEP */ 62 63#ifdef CONFIG_PM 64 65/* 66 * sysfs.c 67 */ 68 69extern int dpm_sysfs_add(struct device *dev); 70extern void dpm_sysfs_remove(struct device *dev); 71extern void rpm_sysfs_remove(struct device *dev); 72extern int wakeup_sysfs_add(struct device *dev); 73extern void wakeup_sysfs_remove(struct device *dev); 74extern int pm_qos_sysfs_add(struct device *dev); 75extern void pm_qos_sysfs_remove(struct device *dev); 76 77#else /* CONFIG_PM */ 78 79static inline int dpm_sysfs_add(struct device *dev) { return 0; } 80static inline void dpm_sysfs_remove(struct device *dev) {} 81static inline void rpm_sysfs_remove(struct device *dev) {} 82static inline int wakeup_sysfs_add(struct device *dev) { return 0; } 83static inline void wakeup_sysfs_remove(struct device *dev) {} 84static inline int pm_qos_sysfs_add(struct device *dev) { return 0; } 85static inline void pm_qos_sysfs_remove(struct device *dev) {} 86 87#endif 88