blob: 6f0dfca8ebdd2437da619ab7a0c89abd7a60dcca [file] [log] [blame]
Rafael J. Wysocki296699d2007-07-29 23:27:18 +02001#ifdef CONFIG_PM_SLEEP
Linus Torvalds1da177e2005-04-16 15:20:36 -07002
3/*
4 * main.c
5 */
6
Alan Sterncd59abf2007-09-21 15:36:56 -04007extern struct list_head dpm_active; /* The active device list */
Linus Torvalds1da177e2005-04-16 15:20:36 -07008
Daniel Drakedec13c12007-11-21 14:55:18 -08009static inline struct device *to_device(struct list_head *entry)
Linus Torvalds1da177e2005-04-16 15:20:36 -070010{
Alan Sterncd59abf2007-09-21 15:36:56 -040011 return container_of(entry, struct device, power.entry);
Linus Torvalds1da177e2005-04-16 15:20:36 -070012}
13
Daniel Drakedec13c12007-11-21 14:55:18 -080014extern void device_pm_add(struct device *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070015extern void device_pm_remove(struct device *);
Rafael J. Wysocki775b64d2008-01-12 20:40:46 +010016extern void device_pm_schedule_removal(struct device *);
17extern int pm_sleep_lock(void);
18extern void pm_sleep_unlock(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070019
Daniel Drakedec13c12007-11-21 14:55:18 -080020#else /* CONFIG_PM_SLEEP */
21
22
23static inline void device_pm_add(struct device *dev)
24{
25}
26
27static inline void device_pm_remove(struct device *dev)
28{
29}
30
Rafael J. Wysocki775b64d2008-01-12 20:40:46 +010031static inline int pm_sleep_lock(void)
32{
33 return 0;
34}
35
36static inline void pm_sleep_unlock(void)
37{
38}
39
Daniel Drakedec13c12007-11-21 14:55:18 -080040#endif
41
42#ifdef CONFIG_PM
43
Linus Torvalds1da177e2005-04-16 15:20:36 -070044/*
45 * sysfs.c
46 */
47
48extern int dpm_sysfs_add(struct device *);
49extern void dpm_sysfs_remove(struct device *);
50
Daniel Drakedec13c12007-11-21 14:55:18 -080051#else /* CONFIG_PM */
Linus Torvalds1da177e2005-04-16 15:20:36 -070052
Daniel Drakedec13c12007-11-21 14:55:18 -080053static inline int dpm_sysfs_add(struct device *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -070054{
55 return 0;
56}
Linus Torvalds1da177e2005-04-16 15:20:36 -070057
Daniel Drakedec13c12007-11-21 14:55:18 -080058static inline void dpm_sysfs_remove(struct device *dev)
59{
Linus Torvalds1da177e2005-04-16 15:20:36 -070060}
61
Linus Torvalds1da177e2005-04-16 15:20:36 -070062#endif