Rafael J. Wysocki | 5e928f7 | 2009-08-18 23:38:32 +0200 | [diff] [blame] | 1 | #ifdef CONFIG_PM_RUNTIME |
| 2 | |
| 3 | extern void pm_runtime_init(struct device *dev); |
| 4 | extern void pm_runtime_remove(struct device *dev); |
| 5 | |
| 6 | #else /* !CONFIG_PM_RUNTIME */ |
| 7 | |
| 8 | static inline void pm_runtime_init(struct device *dev) {} |
| 9 | static inline void pm_runtime_remove(struct device *dev) {} |
| 10 | |
| 11 | #endif /* !CONFIG_PM_RUNTIME */ |
Alan Stern | 3b98aea | 2008-08-07 13:06:12 -0400 | [diff] [blame] | 12 | |
Rafael J. Wysocki | 296699d | 2007-07-29 23:27:18 +0200 | [diff] [blame] | 13 | #ifdef CONFIG_PM_SLEEP |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | |
Rafael J. Wysocki | 0e06b4a | 2010-01-23 22:25:15 +0100 | [diff] [blame] | 15 | /* kernel/power/main.c */ |
| 16 | extern int pm_async_enabled; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | |
Rafael J. Wysocki | 0e06b4a | 2010-01-23 22:25:15 +0100 | [diff] [blame] | 18 | /* drivers/base/power/main.c */ |
Rafael J. Wysocki | 1eede07 | 2008-05-20 23:00:01 +0200 | [diff] [blame] | 19 | extern struct list_head dpm_list; /* The active device list */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | |
Daniel Drake | dec13c1 | 2007-11-21 14:55:18 -0800 | [diff] [blame] | 21 | static inline struct device *to_device(struct list_head *entry) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | { |
Alan Stern | cd59abf | 2007-09-21 15:36:56 -0400 | [diff] [blame] | 23 | return container_of(entry, struct device, power.entry); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | } |
| 25 | |
Rafael J. Wysocki | 5e928f7 | 2009-08-18 23:38:32 +0200 | [diff] [blame] | 26 | extern void device_pm_init(struct device *dev); |
Alan Stern | 3b98aea | 2008-08-07 13:06:12 -0400 | [diff] [blame] | 27 | extern void device_pm_add(struct device *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | extern void device_pm_remove(struct device *); |
Cornelia Huck | ffa6a70 | 2009-03-04 12:44:00 +0100 | [diff] [blame] | 29 | extern void device_pm_move_before(struct device *, struct device *); |
| 30 | extern void device_pm_move_after(struct device *, struct device *); |
| 31 | extern void device_pm_move_last(struct device *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | |
Rafael J. Wysocki | 5e928f7 | 2009-08-18 23:38:32 +0200 | [diff] [blame] | 33 | #else /* !CONFIG_PM_SLEEP */ |
| 34 | |
| 35 | static inline void device_pm_init(struct device *dev) |
| 36 | { |
Rafael J. Wysocki | 074037e | 2010-09-22 22:09:10 +0200 | [diff] [blame] | 37 | spin_lock_init(&dev->power.lock); |
Rafael J. Wysocki | 5e928f7 | 2009-08-18 23:38:32 +0200 | [diff] [blame] | 38 | pm_runtime_init(dev); |
| 39 | } |
| 40 | |
| 41 | static inline void device_pm_remove(struct device *dev) |
| 42 | { |
| 43 | pm_runtime_remove(dev); |
| 44 | } |
Daniel Drake | dec13c1 | 2007-11-21 14:55:18 -0800 | [diff] [blame] | 45 | |
Alan Stern | 3b98aea | 2008-08-07 13:06:12 -0400 | [diff] [blame] | 46 | static inline void device_pm_add(struct device *dev) {} |
Cornelia Huck | ffa6a70 | 2009-03-04 12:44:00 +0100 | [diff] [blame] | 47 | static inline void device_pm_move_before(struct device *deva, |
| 48 | struct device *devb) {} |
| 49 | static inline void device_pm_move_after(struct device *deva, |
| 50 | struct device *devb) {} |
| 51 | static inline void device_pm_move_last(struct device *dev) {} |
Rafael J. Wysocki | 775b64d | 2008-01-12 20:40:46 +0100 | [diff] [blame] | 52 | |
Rafael J. Wysocki | 5e928f7 | 2009-08-18 23:38:32 +0200 | [diff] [blame] | 53 | #endif /* !CONFIG_PM_SLEEP */ |
Daniel Drake | dec13c1 | 2007-11-21 14:55:18 -0800 | [diff] [blame] | 54 | |
| 55 | #ifdef CONFIG_PM |
| 56 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | /* |
| 58 | * sysfs.c |
| 59 | */ |
| 60 | |
Rafael J. Wysocki | cb8f51b | 2011-02-08 23:26:02 +0100 | [diff] [blame] | 61 | extern int dpm_sysfs_add(struct device *dev); |
| 62 | extern void dpm_sysfs_remove(struct device *dev); |
| 63 | extern void rpm_sysfs_remove(struct device *dev); |
| 64 | extern int wakeup_sysfs_add(struct device *dev); |
| 65 | extern void wakeup_sysfs_remove(struct device *dev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | |
Daniel Drake | dec13c1 | 2007-11-21 14:55:18 -0800 | [diff] [blame] | 67 | #else /* CONFIG_PM */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | |
Rafael J. Wysocki | cb8f51b | 2011-02-08 23:26:02 +0100 | [diff] [blame] | 69 | static inline int dpm_sysfs_add(struct device *dev) { return 0; } |
| 70 | static inline void dpm_sysfs_remove(struct device *dev) {} |
| 71 | static inline void rpm_sysfs_remove(struct device *dev) {} |
| 72 | static inline int wakeup_sysfs_add(struct device *dev) { return 0; } |
| 73 | static inline void wakeup_sysfs_remove(struct device *dev) {} |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | #endif |