qdf_notifier.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /*
  2. * Copyright (c) 2020, The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for any
  6. * purpose with or without fee is hereby granted, provided that the above
  7. * copyright notice and this permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  10. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  11. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  12. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  13. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  14. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  15. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  16. */
  17. /**
  18. * DOC: qdf_notifier.h
  19. * This file abstracts notifier chain call operations.
  20. */
  21. #ifndef _QDF_NOTIFIER_H
  22. #define _QDF_NOTIFIER_H
  23. #include <i_qdf_notifier.h>
  24. #include <qdf_status.h>
  25. /**
  26. * typedef qdf_notif_block - qdf notifier block
  27. * @notif_block: OS specific notifier block
  28. * @priv_data: private data of the notifier block
  29. */
  30. typedef struct {
  31. __qdf_notifier_block notif_block;
  32. void *priv_data;
  33. } qdf_notif_block;
  34. typedef __qdf_blocking_notif_head qdf_blocking_notif_head;
  35. typedef __qdf_atomic_notif_head qdf_atomic_notif_head;
  36. typedef __qdf_notifier_block qdf_notifier_block;
  37. #ifdef WLAN_HANG_EVENT
  38. /**
  39. * qdf_register_blocking_notifier_chain() - Register for blocking notifier chain
  40. * @head: Head of blocking notifier chain
  41. * @qnb: Notifier Block to be registered for this head chain
  42. *
  43. * This function is invoked to add a notifier block for the specific notifier
  44. * head chain.
  45. *
  46. * Return: QDF_STATUS
  47. */
  48. QDF_STATUS qdf_register_blocking_notifier_chain(qdf_blocking_notif_head *head,
  49. qdf_notif_block *qnb);
  50. /**
  51. * qdf_unregister_blocking_notifier_chain() - Unregister for blocking notifier
  52. * chain
  53. * @head: Head of blocking notifier chain
  54. * @qnb: Notifier Block to be unregistered from this head chain
  55. *
  56. * This function is invoked to remove a notifier block for the specific notifier
  57. * head chain.
  58. *
  59. * Return: QDF_STATUS
  60. */
  61. QDF_STATUS qdf_unregister_blocking_notifier_chain(qdf_blocking_notif_head *head,
  62. qdf_notif_block *qnb);
  63. /**
  64. * qdf_blocking_notfier_call() - Invoke the function in the blocking chain
  65. * @head: Head of blocking notifier chain
  66. * @state: state passed during the invoking of the notifier
  67. * @data: Private data to be passed to all the notifier functions
  68. *
  69. * This function is called to invoke all the notifier blocks for the specific
  70. * notifier chain with state and private data.
  71. * when success the notifier reply with NOTIFY_OK.
  72. *
  73. * Return: QDF_STATUS
  74. */
  75. QDF_STATUS qdf_blocking_notfier_call(qdf_blocking_notif_head *head,
  76. unsigned long state, void *data);
  77. /**
  78. * qdf_register_atomic_notifier_chain() - Register for atomic notifier chain
  79. * @head: Head of atomic notifier chain
  80. * @qnb: Notifier Block to be registered for this head chain
  81. *
  82. * This function is invoked to add a notifier block for the specific atomic
  83. * notifier head chain.
  84. *
  85. * Return: QDF_STATUS
  86. */
  87. QDF_STATUS qdf_register_atomic_notifier_chain(qdf_atomic_notif_head *head,
  88. qdf_notif_block *qnb);
  89. /**
  90. * qdf_unregister_atomic_notifier_chain() - Unregister for atomic notifier
  91. * chain
  92. * @head: Head of atomic notifier chain
  93. * @qnb: Notifier Block to be unregistered from this head chain
  94. *
  95. * This function is invoked to remove a notifier block for the specific notifier
  96. * head chain.
  97. *
  98. * Return: QDF_STATUS
  99. */
  100. QDF_STATUS qdf_unregister_atomic_notifier_chain(qdf_atomic_notif_head *head,
  101. qdf_notif_block *qnb);
  102. /**
  103. * qdf_atomic_notfier_call() - Invoke the function in the blocking chain
  104. * @head: Head of atomic notifier chain
  105. * @v: Generally state passed during the invoking of the notifier
  106. * @data: Private data to be passed to all the notifier functions
  107. *
  108. * This function is invoke a notifier block for the specific notifier head chain
  109. * with state and private data. when success the notifier reply with NOTIFY_OK.
  110. *
  111. * Return: QDF_STATUS
  112. */
  113. QDF_STATUS qdf_atomic_notfier_call(qdf_atomic_notif_head *head,
  114. unsigned long v, void *data);
  115. #else
  116. static inline QDF_STATUS qdf_register_blocking_notifier_chain(
  117. qdf_blocking_notif_head *head,
  118. qdf_notif_block *qnb)
  119. {
  120. return QDF_STATUS_SUCCESS;
  121. }
  122. static inline QDF_STATUS qdf_unregister_blocking_notifier_chain(
  123. qdf_blocking_notif_head *head,
  124. qdf_notif_block *qnb)
  125. {
  126. return QDF_STATUS_SUCCESS;
  127. }
  128. static inline QDF_STATUS qdf_blocking_notfier_call(
  129. qdf_blocking_notif_head *head,
  130. unsigned long v, void *data)
  131. {
  132. return QDF_STATUS_SUCCESS;
  133. }
  134. static inline QDF_STATUS qdf_register_atomic_notifier_chain(
  135. qdf_atomic_notif_head *head,
  136. qdf_notif_block *qnb)
  137. {
  138. return QDF_STATUS_SUCCESS;
  139. }
  140. static inline QDF_STATUS qdf_unregister_atomic_notifier_chain(
  141. qdf_atomic_notif_head *head,
  142. qdf_notif_block *qnb)
  143. {
  144. return QDF_STATUS_SUCCESS;
  145. }
  146. static inline QDF_STATUS qdf_atomic_notfier_call(qdf_atomic_notif_head *head,
  147. unsigned long v, void *data)
  148. {
  149. return QDF_STATUS_SUCCESS;
  150. }
  151. #endif
  152. #endif