power.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 *dev);
  45. extern void dpm_sysfs_remove(struct device *dev);
  46. extern void rpm_sysfs_remove(struct device *dev);
  47. extern int wakeup_sysfs_add(struct device *dev);
  48. extern void wakeup_sysfs_remove(struct device *dev);
  49. #else /* CONFIG_PM */
  50. static inline int dpm_sysfs_add(struct device *dev) { return 0; }
  51. static inline void dpm_sysfs_remove(struct device *dev) {}
  52. static inline void rpm_sysfs_remove(struct device *dev) {}
  53. static inline int wakeup_sysfs_add(struct device *dev) { return 0; }
  54. static inline void wakeup_sysfs_remove(struct device *dev) {}
  55. #endif