1 /*
2 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. 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: wlan_qmi_objmgr.h
19 *
20 * This file contains various object manager related wrappers and helpers
21 */
22
23 #ifndef _WLAN_QMI_OBJMGR_H_
24 #define _WLAN_QMI_OBJMGR_H_
25
26 #include "wlan_cmn.h"
27 #include "wlan_objmgr_cmn.h"
28 #include "wlan_objmgr_psoc_obj.h"
29 #include "wlan_qmi_priv.h"
30
31 #define qmi_comp_psoc_get_ref(psoc) wlan_objmgr_psoc_try_get_ref(psoc, \
32 WLAN_QMI_ID)
33
34 #define qmi_comp_psoc_put_ref(psoc) wlan_objmgr_psoc_release_ref(psoc, \
35 WLAN_QMI_ID)
36
37 /**
38 * qmi_psoc_get_priv() - Wrapper to retrieve psoc priv obj
39 * @psoc: psoc pointer
40 *
41 * Return: QMI psoc private object
42 */
43 static inline
qmi_psoc_get_priv(struct wlan_objmgr_psoc * psoc)44 struct wlan_qmi_psoc_context *qmi_psoc_get_priv(struct wlan_objmgr_psoc *psoc)
45 {
46 struct wlan_qmi_psoc_context *qmi_ctx;
47
48 qmi_ctx = wlan_objmgr_psoc_get_comp_private_obj(psoc,
49 WLAN_UMAC_COMP_QMI);
50 QDF_BUG(qmi_ctx);
51
52 return qmi_ctx;
53 }
54 #endif
55