qdf_notifier.h 5.2 KB

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