reset.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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 *reset_control_get_optional(
  61. struct device *dev, const char *id)
  62. {
  63. return ERR_PTR(-ENOSYS);
  64. }
  65. static inline struct reset_control *devm_reset_control_get_optional(
  66. struct device *dev, const char *id)
  67. {
  68. return ERR_PTR(-ENOSYS);
  69. }
  70. static inline struct reset_control *of_reset_control_get(
  71. struct device_node *node, const char *id)
  72. {
  73. return ERR_PTR(-ENOSYS);
  74. }
  75. #endif /* CONFIG_RESET_CONTROLLER */
  76. #endif