reset.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #ifndef _LINUX_RESET_H_
  2. #define _LINUX_RESET_H_
  3. struct device;
  4. struct device_node;
  5. struct reset_control;
  6. #ifdef CONFIG_RESET_CONTROLLER
  7. int reset_control_reset(struct reset_control *rstc);
  8. int reset_control_assert(struct reset_control *rstc);
  9. int reset_control_deassert(struct reset_control *rstc);
  10. int reset_control_status(struct reset_control *rstc);
  11. struct reset_control *reset_control_get(struct device *dev, const char *id);
  12. void reset_control_put(struct reset_control *rstc);
  13. struct reset_control *devm_reset_control_get(struct device *dev, const char *id);
  14. int __must_check device_reset(struct device *dev);
  15. static inline int device_reset_optional(struct device *dev)
  16. {
  17. return device_reset(dev);
  18. }
  19. static inline struct reset_control *reset_control_get_optional(
  20. struct device *dev, const char *id)
  21. {
  22. return reset_control_get(dev, id);
  23. }
  24. static inline struct reset_control *devm_reset_control_get_optional(
  25. struct device *dev, const char *id)
  26. {
  27. return devm_reset_control_get(dev, id);
  28. }
  29. struct reset_control *of_reset_control_get(struct device_node *node,
  30. const char *id);
  31. #else
  32. static inline int reset_control_reset(struct reset_control *rstc)
  33. {
  34. WARN_ON(1);
  35. return 0;
  36. }
  37. static inline int reset_control_assert(struct reset_control *rstc)
  38. {
  39. WARN_ON(1);
  40. return 0;
  41. }
  42. static inline int reset_control_deassert(struct reset_control *rstc)
  43. {
  44. WARN_ON(1);
  45. return 0;
  46. }
  47. static inline int reset_control_status(struct reset_control *rstc)
  48. {
  49. WARN_ON(1);
  50. return 0;
  51. }
  52. static inline void reset_control_put(struct reset_control *rstc)
  53. {
  54. WARN_ON(1);
  55. }
  56. static inline int device_reset_optional(struct device *dev)
  57. {
  58. return -ENOSYS;
  59. }
  60. static inline struct reset_control *__must_check reset_control_get(
  61. struct device *dev, const char *id)
  62. {
  63. WARN_ON(1);
  64. return ERR_PTR(-EINVAL);
  65. }
  66. static inline struct reset_control *__must_check devm_reset_control_get(
  67. struct device *dev, const char *id)
  68. {
  69. WARN_ON(1);
  70. return ERR_PTR(-EINVAL);
  71. }
  72. static inline struct reset_control *reset_control_get_optional(
  73. struct device *dev, const char *id)
  74. {
  75. return ERR_PTR(-ENOSYS);
  76. }
  77. static inline struct reset_control *devm_reset_control_get_optional(
  78. struct device *dev, const char *id)
  79. {
  80. return ERR_PTR(-ENOSYS);
  81. }
  82. static inline struct reset_control *of_reset_control_get(
  83. struct device_node *node, const char *id)
  84. {
  85. return ERR_PTR(-ENOSYS);
  86. }
  87. #endif /* CONFIG_RESET_CONTROLLER */
  88. #endif