power.h 994 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #ifdef CONFIG_PM_SLEEP
  2. /*
  3. * main.c
  4. */
  5. extern struct list_head dpm_active; /* The active device list */
  6. static inline struct device *to_device(struct list_head *entry)
  7. {
  8. return container_of(entry, struct device, power.entry);
  9. }
  10. extern void device_pm_add(struct device *);
  11. extern void device_pm_remove(struct device *);
  12. extern void device_pm_schedule_removal(struct device *);
  13. extern int pm_sleep_lock(void);
  14. extern void pm_sleep_unlock(void);
  15. #else /* CONFIG_PM_SLEEP */
  16. static inline void device_pm_add(struct device *dev)
  17. {
  18. }
  19. static inline void device_pm_remove(struct device *dev)
  20. {
  21. }
  22. static inline int pm_sleep_lock(void)
  23. {
  24. return 0;
  25. }
  26. static inline void pm_sleep_unlock(void)
  27. {
  28. }
  29. #endif
  30. #ifdef CONFIG_PM
  31. /*
  32. * sysfs.c
  33. */
  34. extern int dpm_sysfs_add(struct device *);
  35. extern void dpm_sysfs_remove(struct device *);
  36. #else /* CONFIG_PM */
  37. static inline int dpm_sysfs_add(struct device *dev)
  38. {
  39. return 0;
  40. }
  41. static inline void dpm_sysfs_remove(struct device *dev)
  42. {
  43. }
  44. #endif