reset.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. struct reset_control *reset_control_get(struct device *dev, const char *id);
  11. void reset_control_put(struct reset_control *rstc);
  12. struct reset_control *devm_reset_control_get(struct device *dev, const char *id);
  13. int __must_check device_reset(struct device *dev);
  14. static inline int device_reset_optional(struct device *dev)
  15. {
  16. return device_reset(dev);
  17. }
  18. static inline struct reset_control *reset_control_get_optional(
  19. struct device *dev, const char *id)
  20. {
  21. return reset_control_get(dev, id);
  22. }
  23. static inline struct reset_control *devm_reset_control_get_optional(
  24. struct device *dev, const char *id)
  25. {
  26. return devm_reset_control_get(dev, id);
  27. }
  28. struct reset_control *of_reset_control_get(struct device_node *node,
  29. const char *id);
  30. #else
  31. static inline int reset_control_reset(struct reset_control *rstc)
  32. {
  33. WARN_ON(1);
  34. return 0;
  35. }
  36. static inline int reset_control_assert(struct reset_control *rstc)
  37. {
  38. WARN_ON(1);
  39. return 0;
  40. }
  41. static inline int reset_control_deassert(struct reset_control *rstc)
  42. {
  43. WARN_ON(1);
  44. return 0;
  45. }
  46. static inline void reset_control_put(struct reset_control *rstc)
  47. {
  48. WARN_ON(1);
  49. }
  50. static inline int device_reset_optional(struct device *dev)
  51. {
  52. return -ENOSYS;
  53. }
  54. static inline struct reset_control *reset_control_get_optional(
  55. struct device *dev, const char *id)
  56. {
  57. return ERR_PTR(-ENOSYS);
  58. }
  59. static inline struct reset_control *devm_reset_control_get_optional(
  60. struct device *dev, const char *id)
  61. {
  62. return ERR_PTR(-ENOSYS);
  63. }
  64. static inline struct reset_control *of_reset_control_get(
  65. struct device_node *node, const char *id)
  66. {
  67. return ERR_PTR(-ENOSYS);
  68. }
  69. #endif /* CONFIG_RESET_CONTROLLER */
  70. #endif