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  /**
18   * DOC: i_qdf_notifier.h
19   *
20   * Linux-specific definitions for use by QDF notifier APIs
21   */
22 
23 #ifndef __I_QDF_NOTIFIER_H
24 #define __I_QDF_NOTIFIER_H
25 
26 #include <linux/notifier.h>
27 
28 typedef struct blocking_notifier_head __qdf_blocking_notif_head;
29 typedef struct atomic_notifier_head __qdf_atomic_notif_head;
30 typedef struct notifier_block __qdf_notifier_block;
31 #define qdf_blocking_notifier_init(p) BLOCKING_NOTIFIER_HEAD(p);
32 #define qdf_atomic_notifier_init(p) ATOMIC_NOTIFIER_HEAD(p);
33 
34 static inline int
__qdf_register_blocking_notifier_chain(__qdf_blocking_notif_head * head,__qdf_notifier_block * qnb)35 __qdf_register_blocking_notifier_chain(__qdf_blocking_notif_head *head,
36 				       __qdf_notifier_block *qnb)
37 {
38 	return blocking_notifier_chain_register(head, qnb);
39 }
40 
41 static inline int
__qdf_unregister_blocking_notifier_chain(__qdf_blocking_notif_head * head,__qdf_notifier_block * qnb)42 __qdf_unregister_blocking_notifier_chain(__qdf_blocking_notif_head *head,
43 					 __qdf_notifier_block *qnb)
44 {
45 	return blocking_notifier_chain_unregister(head, qnb);
46 }
47 
48 static inline int
__qdf_blocking_notfier_call(__qdf_blocking_notif_head * head,unsigned long v,void * data)49 __qdf_blocking_notfier_call(__qdf_blocking_notif_head *head,
50 			    unsigned long v, void *data)
51 {
52 	return blocking_notifier_call_chain(head, v, data);
53 }
54 
55 static inline int
__qdf_register_atomic_notifier_chain(__qdf_atomic_notif_head * head,__qdf_notifier_block * qnb)56 __qdf_register_atomic_notifier_chain(__qdf_atomic_notif_head *head,
57 				     __qdf_notifier_block *qnb)
58 {
59 	return atomic_notifier_chain_register(head, qnb);
60 }
61 
62 static inline int
__qdf_unregister_atomic_notifier_chain(__qdf_atomic_notif_head * head,__qdf_notifier_block * qnb)63 __qdf_unregister_atomic_notifier_chain(__qdf_atomic_notif_head *head,
64 				       __qdf_notifier_block *qnb)
65 {
66 	return atomic_notifier_chain_unregister(head, qnb);
67 }
68 
69 static inline int
__qdf_atomic_notifier_call(__qdf_atomic_notif_head * head,unsigned long v,void * data)70 __qdf_atomic_notifier_call(__qdf_atomic_notif_head *head,
71 			   unsigned long v, void *data)
72 {
73 	return atomic_notifier_call_chain(head, v, data);
74 }
75 
76 #endif
77