Govind Singh | 041cf61 | 2020-01-27 10:59:59 +0530 | [diff] [blame^] | 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: 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 | */ |
| 38 | static inline |
| 39 | QDF_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 | */ |
| 52 | static inline |
| 53 | void 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 | */ |
| 66 | static inline struct ftm_timesync_vdev_priv * |
| 67 | ftm_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 */ |