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 *); |
Cornelia Huck | ffa6a70 | 2009-03-04 12:44:00 +0100 | [diff] [blame^] | 21 | extern void device_pm_move_before(struct device *, struct device *); |
| 22 | extern void device_pm_move_after(struct device *, struct device *); |
| 23 | extern void device_pm_move_last(struct device *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | |
Daniel Drake | dec13c1 | 2007-11-21 14:55:18 -0800 | [diff] [blame] | 25 | #else /* CONFIG_PM_SLEEP */ |
| 26 | |
Alan Stern | 3b98aea | 2008-08-07 13:06:12 -0400 | [diff] [blame] | 27 | static inline void device_pm_add(struct device *dev) {} |
Rafael J. Wysocki | 58aca23 | 2008-03-12 00:57:22 +0100 | [diff] [blame] | 28 | static inline void device_pm_remove(struct device *dev) {} |
Cornelia Huck | ffa6a70 | 2009-03-04 12:44:00 +0100 | [diff] [blame^] | 29 | static inline void device_pm_move_before(struct device *deva, |
| 30 | struct device *devb) {} |
| 31 | static inline void device_pm_move_after(struct device *deva, |
| 32 | struct device *devb) {} |
| 33 | static inline void device_pm_move_last(struct device *dev) {} |
Rafael J. Wysocki | 775b64d | 2008-01-12 20:40:46 +0100 | [diff] [blame] | 34 | |
Daniel Drake | dec13c1 | 2007-11-21 14:55:18 -0800 | [diff] [blame] | 35 | #endif |
| 36 | |
| 37 | #ifdef CONFIG_PM |
| 38 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | /* |
| 40 | * sysfs.c |
| 41 | */ |
| 42 | |
| 43 | extern int dpm_sysfs_add(struct device *); |
| 44 | extern void dpm_sysfs_remove(struct device *); |
| 45 | |
Daniel Drake | dec13c1 | 2007-11-21 14:55:18 -0800 | [diff] [blame] | 46 | #else /* CONFIG_PM */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | |
Daniel Drake | dec13c1 | 2007-11-21 14:55:18 -0800 | [diff] [blame] | 48 | static inline int dpm_sysfs_add(struct device *dev) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | { |
| 50 | return 0; |
| 51 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | |
Daniel Drake | dec13c1 | 2007-11-21 14:55:18 -0800 | [diff] [blame] | 53 | static inline void dpm_sysfs_remove(struct device *dev) |
| 54 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | } |
| 56 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | #endif |