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