blob: 59b6168e5d9bf72e56a5935c150bc7653c3ee917 [file] [log] [blame]
Govind Singh041cf612020-01-27 10:59:59 +05301/*
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: This file contains various object manager related wrappers and helpers
19 */
20
21#ifndef _FTM_TIME_SYNC_OBJMGR_H
22#define _FTM_TIME_SYNC_OBJMGR_H
23
24#include "wlan_cmn.h"
25#include "wlan_objmgr_cmn.h"
26#include "wlan_objmgr_vdev_obj.h"
27#include "wlan_objmgr_global_obj.h"
28
29/**
30 * ftm_timesync_vdev_get_ref() - Wrapper to increment ftm_timesync ref count
31 * @vdev: vdev object
32 *
33 * Wrapper for ftm_timesync to increment ref count after checking valid
34 * object state.
35 *
36 * Return: SUCCESS/FAILURE
37 */
38static inline
39QDF_STATUS ftm_timesync_vdev_get_ref(struct wlan_objmgr_vdev *vdev)
40{
41 return wlan_objmgr_vdev_try_get_ref(vdev, FTM_TIME_SYNC_ID);
42}
43
44/**
45 * ftm_timesync_vdev_put_ref() - Wrapper to decrement ftm_timesync ref count
46 * @vdev: vdev object
47 *
48 * Wrapper for ftm_timesync to decrement ref count of vdev.
49 *
50 * Return: SUCCESS/FAILURE
51 */
52static inline
53void ftm_timesync_vdev_put_ref(struct wlan_objmgr_vdev *vdev)
54{
55 return wlan_objmgr_vdev_release_ref(vdev, FTM_TIME_SYNC_ID);
56}
57
58/**
59 * ftm_timesync_vdev_get_priv(): Wrapper to retrieve vdev priv obj
60 * @vdev: vdev pointer
61 *
62 * Wrapper for ftm_timesync to get vdev private object pointer.
63 *
64 * Return: Private object of vdev
65 */
66static inline struct ftm_timesync_vdev_priv *
67ftm_timesync_vdev_get_priv(struct wlan_objmgr_vdev *vdev)
68{
69 struct ftm_timesync_vdev_priv *vdev_priv;
70
71 vdev_priv = wlan_objmgr_vdev_get_comp_private_obj(
72 vdev, WLAN_UMAC_COMP_FTM_TIME_SYNC);
73 QDF_BUG(vdev_priv);
74
75 return vdev_priv;
76}
77
78#endif /* _FTM_TIME_SYNC_OBJMGR_H */