blob: 41f51fae042f06f06d7548f4ad10463b7b399f4f [file] [log] [blame]
Alan Stern3b98aea2008-08-07 13:06:12 -04001static inline void device_pm_init(struct device *dev)
2{
3 dev->power.status = DPM_ON;
4}
5
Rafael J. Wysocki296699d2007-07-29 23:27:18 +02006#ifdef CONFIG_PM_SLEEP
Linus Torvalds1da177e2005-04-16 15:20:36 -07007
8/*
9 * main.c
10 */
11
Rafael J. Wysocki1eede072008-05-20 23:00:01 +020012extern struct list_head dpm_list; /* The active device list */
Linus Torvalds1da177e2005-04-16 15:20:36 -070013
Daniel Drakedec13c12007-11-21 14:55:18 -080014static inline struct device *to_device(struct list_head *entry)
Linus Torvalds1da177e2005-04-16 15:20:36 -070015{
Alan Sterncd59abf2007-09-21 15:36:56 -040016 return container_of(entry, struct device, power.entry);
Linus Torvalds1da177e2005-04-16 15:20:36 -070017}
18
Alan Stern3b98aea2008-08-07 13:06:12 -040019extern void device_pm_add(struct device *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070020extern void device_pm_remove(struct device *);
21
Daniel Drakedec13c12007-11-21 14:55:18 -080022#else /* CONFIG_PM_SLEEP */
23
Alan Stern3b98aea2008-08-07 13:06:12 -040024static inline void device_pm_add(struct device *dev) {}
Rafael J. Wysocki58aca232008-03-12 00:57:22 +010025static inline void device_pm_remove(struct device *dev) {}
Rafael J. Wysocki775b64d2008-01-12 20:40:46 +010026
Daniel Drakedec13c12007-11-21 14:55:18 -080027#endif
28
29#ifdef CONFIG_PM
30
Linus Torvalds1da177e2005-04-16 15:20:36 -070031/*
32 * sysfs.c
33 */
34
35extern int dpm_sysfs_add(struct device *);
36extern void dpm_sysfs_remove(struct device *);
37
Daniel Drakedec13c12007-11-21 14:55:18 -080038#else /* CONFIG_PM */
Linus Torvalds1da177e2005-04-16 15:20:36 -070039
Daniel Drakedec13c12007-11-21 14:55:18 -080040static inline int dpm_sysfs_add(struct device *dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -070041{
42 return 0;
43}
Linus Torvalds1da177e2005-04-16 15:20:36 -070044
Daniel Drakedec13c12007-11-21 14:55:18 -080045static inline void dpm_sysfs_remove(struct device *dev)
46{
Linus Torvalds1da177e2005-04-16 15:20:36 -070047}
48
Linus Torvalds1da177e2005-04-16 15:20:36 -070049#endif