xref: /wlan-driver/qcacld-3.0/components/action_oui/core/inc/wlan_action_oui_objmgr.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2018 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 /**
20  * DOC: This file contains various object manager related wrappers and helpers
21  */
22 
23 #ifndef _WLAN_ACTION_OUI_OBJMGR_H
24 #define _WLAN_ACTION_OUI_OBJMGR_H
25 
26 #include "wlan_cmn.h"
27 #include "wlan_objmgr_cmn.h"
28 #include "wlan_objmgr_psoc_obj.h"
29 
30 /**
31  * action_oui_psoc_get_ref() - Wrapper to increment action_oui ref count
32  * @psoc: psoc object
33  *
34  * Wrapper for action_oui to increment ref count after checking valid
35  * object state.
36  *
37  * Return: SUCCESS/FAILURE
38  */
39 static inline
action_oui_psoc_get_ref(struct wlan_objmgr_psoc * psoc)40 QDF_STATUS action_oui_psoc_get_ref(struct wlan_objmgr_psoc *psoc)
41 {
42 	return wlan_objmgr_psoc_try_get_ref(psoc, WLAN_ACTION_OUI_ID);
43 }
44 
45 /**
46  * action_oui_psoc_put_ref() - Wrapper to decrement action_oui ref count
47  * @psoc: psoc object
48  *
49  * Wrapper for action_oui to decrement ref count of psoc.
50  *
51  * Return: SUCCESS/FAILURE
52  */
53 static inline
action_oui_psoc_put_ref(struct wlan_objmgr_psoc * psoc)54 void action_oui_psoc_put_ref(struct wlan_objmgr_psoc *psoc)
55 {
56 	return wlan_objmgr_psoc_release_ref(psoc, WLAN_ACTION_OUI_ID);
57 }
58 
59 /**
60  * action_oui_psoc_get_priv(): Wrapper to retrieve psoc priv obj
61  * @psoc: psoc pointer
62  *
63  * Wrapper for action_oui to get psoc private object pointer.
64  *
65  * Return: Private object of psoc
66  */
67 static inline struct action_oui_psoc_priv *
action_oui_psoc_get_priv(struct wlan_objmgr_psoc * psoc)68 action_oui_psoc_get_priv(struct wlan_objmgr_psoc *psoc)
69 {
70 	struct action_oui_psoc_priv *psoc_priv;
71 
72 	psoc_priv = wlan_objmgr_psoc_get_comp_private_obj(psoc,
73 					WLAN_UMAC_COMP_ACTION_OUI);
74 	QDF_BUG(psoc_priv);
75 
76 	return psoc_priv;
77 }
78 
79 #endif /* _WLAN_ACTION_OUI_OBJMGR_H */
80