| Alan Stern | 3b98aea | 2008-08-07 13:06:12 -0400 | [diff] [blame] | 1 | static inline void device_pm_init(struct device *dev) |
| 2 | { | ||||
| 3 | dev->power.status = DPM_ON; | ||||
| 4 | } | ||||
| 5 | |||||
| Rafael J. Wysocki | 296699d | 2007-07-29 23:27:18 +0200 | [diff] [blame] | 6 | #ifdef CONFIG_PM_SLEEP |
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | |
| 8 | /* | ||||
| 9 | * main.c | ||||
| 10 | */ | ||||
| 11 | |||||
| Rafael J. Wysocki | 1eede07 | 2008-05-20 23:00:01 +0200 | [diff] [blame] | 12 | extern struct list_head dpm_list; /* The active device list */ |
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | |
| Daniel Drake | dec13c1 | 2007-11-21 14:55:18 -0800 | [diff] [blame] | 14 | static inline struct device *to_device(struct list_head *entry) |
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | { |
| Alan Stern | cd59abf | 2007-09-21 15:36:56 -0400 | [diff] [blame] | 16 | return container_of(entry, struct device, power.entry); |
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | } |
| 18 | |||||
| Alan Stern | 3b98aea | 2008-08-07 13:06:12 -0400 | [diff] [blame] | 19 | extern void device_pm_add(struct device *); |
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | extern void device_pm_remove(struct device *); |
| 21 | |||||
| Daniel Drake | dec13c1 | 2007-11-21 14:55:18 -0800 | [diff] [blame] | 22 | #else /* CONFIG_PM_SLEEP */ |
| 23 | |||||
| Alan Stern | 3b98aea | 2008-08-07 13:06:12 -0400 | [diff] [blame] | 24 | static inline void device_pm_add(struct device *dev) {} |
| Rafael J. Wysocki | 58aca23 | 2008-03-12 00:57:22 +0100 | [diff] [blame] | 25 | static inline void device_pm_remove(struct device *dev) {} |
| Rafael J. Wysocki | 775b64d | 2008-01-12 20:40:46 +0100 | [diff] [blame] | 26 | |
| Daniel Drake | dec13c1 | 2007-11-21 14:55:18 -0800 | [diff] [blame] | 27 | #endif |
| 28 | |||||
| 29 | #ifdef CONFIG_PM | ||||
| 30 | |||||
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | /* |
| 32 | * sysfs.c | ||||
| 33 | */ | ||||
| 34 | |||||
| 35 | extern int dpm_sysfs_add(struct device *); | ||||
| 36 | extern void dpm_sysfs_remove(struct device *); | ||||
| 37 | |||||
| Daniel Drake | dec13c1 | 2007-11-21 14:55:18 -0800 | [diff] [blame] | 38 | #else /* CONFIG_PM */ |
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
| Daniel Drake | dec13c1 | 2007-11-21 14:55:18 -0800 | [diff] [blame] | 40 | static inline int dpm_sysfs_add(struct device *dev) |
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | { |
| 42 | return 0; | ||||
| 43 | } | ||||
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | |
| Daniel Drake | dec13c1 | 2007-11-21 14:55:18 -0800 | [diff] [blame] | 45 | static inline void dpm_sysfs_remove(struct device *dev) |
| 46 | { | ||||
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | } |
| 48 | |||||
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | #endif |