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