power.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. /* kernel/power/main.c */
  10. extern int pm_async_enabled;
  11. /* drivers/base/power/main.c */
  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. spin_lock_init(&dev->power.lock);
  27. pm_runtime_init(dev);
  28. }
  29. static inline void device_pm_remove(struct device *dev)
  30. {
  31. pm_runtime_remove(dev);
  32. }
  33. static inline void device_pm_add(struct device *dev) {}
  34. static inline void device_pm_move_before(struct device *deva,
  35. struct device *devb) {}
  36. static inline void device_pm_move_after(struct device *deva,
  37. struct device *devb) {}
  38. static inline void device_pm_move_last(struct device *dev) {}
  39. #endif /* !CONFIG_PM_SLEEP */
  40. #ifdef CONFIG_PM
  41. /*
  42. * sysfs.c
  43. */
  44. extern int dpm_sysfs_add(struct device *);
  45. extern void dpm_sysfs_remove(struct device *);
  46. extern void rpm_sysfs_remove(struct device *);
  47. #else /* CONFIG_PM */
  48. static inline int dpm_sysfs_add(struct device *dev)
  49. {
  50. return 0;
  51. }
  52. static inline void dpm_sysfs_remove(struct device *dev)
  53. {
  54. }
  55. #endif