qcacmn: Add the notifier chain infrastructure
Notifier chains are simple function list executed when an event occurs. In qdf block and atomic notifier chains are defined. Blocking notifier chains can be used to invoke a list of functions based on event in a process context wherein atomic notifier chain can be used in an interrupt context. Change-Id: I9020b9f19915e084b017932fb6d0bfad792d745c CRs-Fixed: 2648224
This commit is contained in:

committed by
nshrivas

parent
1f9ff8a62c
commit
cf6efc2a39
76
qdf/linux/src/i_qdf_notifier.h
Normal file
76
qdf/linux/src/i_qdf_notifier.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* DOC: i_qdf_notifier.h
|
||||
*
|
||||
* Linux-specific definitions for use by QDF notifier APIs
|
||||
*/
|
||||
|
||||
#ifndef __I_QDF_NOTIFIER_H
|
||||
#define __I_QDF_NOTIFIER_H
|
||||
|
||||
#include <linux/notifier.h>
|
||||
|
||||
typedef struct blocking_notifier_head __qdf_blocking_notif_head;
|
||||
typedef struct atomic_notifier_head __qdf_atomic_notif_head;
|
||||
typedef struct notifier_block __qdf_notifier_block;
|
||||
#define qdf_blocking_notifier_init(p) BLOCKING_NOTIFIER_HEAD(p);
|
||||
#define qdf_atomic_notifier_init(p) ATOMIC_NOTIFIER_HEAD(p);
|
||||
|
||||
static inline int
|
||||
__qdf_register_blocking_notifier_chain(__qdf_blocking_notif_head *head,
|
||||
__qdf_notifier_block *qnb)
|
||||
{
|
||||
return blocking_notifier_chain_register(head, qnb);
|
||||
}
|
||||
|
||||
static inline int
|
||||
__qdf_unregister_blocking_notifier_chain(__qdf_blocking_notif_head *head,
|
||||
__qdf_notifier_block *qnb)
|
||||
{
|
||||
return blocking_notifier_chain_unregister(head, qnb);
|
||||
}
|
||||
|
||||
static inline int
|
||||
__qdf_blocking_notfier_call(__qdf_blocking_notif_head *head,
|
||||
unsigned long v, void *data)
|
||||
{
|
||||
return blocking_notifier_call_chain(head, v, data);
|
||||
}
|
||||
|
||||
static inline int
|
||||
__qdf_register_atomic_notifier_chain(__qdf_atomic_notif_head *head,
|
||||
__qdf_notifier_block *qnb)
|
||||
{
|
||||
return atomic_notifier_chain_register(head, qnb);
|
||||
}
|
||||
|
||||
static inline int
|
||||
__qdf_unregister_atomic_notifier_chain(__qdf_atomic_notif_head *head,
|
||||
__qdf_notifier_block *qnb)
|
||||
{
|
||||
return atomic_notifier_chain_unregister(head, qnb);
|
||||
}
|
||||
|
||||
static inline int
|
||||
__qdf_atomic_notifier_call(__qdf_atomic_notif_head *head,
|
||||
unsigned long v, void *data)
|
||||
{
|
||||
return atomic_notifier_call_chain(head, v, data);
|
||||
}
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user