power.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #ifdef CONFIG_PM_RUNTIME
  2. extern void pm_runtime_init(struct device *dev);
  3. extern void pm_runtime_remove(struct device *dev);
  4. #else /* !CONFIG_PM_RUNTIME */
  5. static inline void pm_runtime_init(struct device *dev) {}
  6. static inline void pm_runtime_remove(struct device *dev) {}
  7. #endif /* !CONFIG_PM_RUNTIME */
  8. #ifdef CONFIG_PM_SLEEP
  9. /*
  10. * main.c
  11. */
  12. extern struct list_head dpm_list; /* The active device list */
  13. static inline struct device *to_device(struct list_head *entry)
  14. {
  15. return container_of(entry, struct device, power.entry);
  16. }
  17. extern void device_pm_init(struct device *dev);
  18. extern void device_pm_add(struct device *);
  19. extern void device_pm_remove(struct device *);
  20. extern void device_pm_move_before(struct device *, struct device *);
  21. extern void device_pm_move_after(struct device *, struct device *);
  22. extern void device_pm_move_last(struct device *);
  23. #else /* !CONFIG_PM_SLEEP */
  24. static inline void device_pm_init(struct device *dev)
  25. {
  26. pm_runtime_init(dev);
  27. }
  28. static inline void device_pm_remove(struct device *dev)
  29. {
  30. pm_runtime_remove(dev);
  31. }
  32. static inline void device_pm_add(struct device *dev) {}
  33. static inline void device_pm_move_before(struct device *deva,
  34. struct device *devb) {}
  35. static inline void device_pm_move_after(struct device *deva,
  36. struct device *devb) {}
  37. static inline void device_pm_move_last(struct device *dev) {}
  38. #endif /* !CONFIG_PM_SLEEP */
  39. #ifdef CONFIG_PM
  40. /*
  41. * sysfs.c
  42. */
  43. extern int dpm_sysfs_add(struct device *);
  44. extern void dpm_sysfs_remove(struct device *);
  45. #else /* CONFIG_PM */
  46. static inline int dpm_sysfs_add(struct device *dev)
  47. {
  48. return 0;
  49. }
  50. static inline void dpm_sysfs_remove(struct device *dev)
  51. {
  52. }
  53. #endif