1 /* 2 * Copyright (c) 2018-2019 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 * DOC: Public Data Structures to perform debug operations 20 * on object manager 21 */ 22 23 #ifndef _WLAN_OBJMGR_DEBUG_H_ 24 #define _WLAN_OBJMGR_DEBUG_H_ 25 26 #include <qdf_timer.h> 27 28 #ifdef WLAN_OBJMGR_DEBUG 29 30 /** 31 * wlan_objmgr_notify_log_delete()- insert 32 * logically deleted object into list 33 * @obj: object to be inserted 34 * @obj_type: type of object to be inserted 35 * 36 * Return: void 37 */ 38 void wlan_objmgr_notify_log_delete(void *obj, 39 enum wlan_objmgr_obj_type obj_type); 40 41 /** 42 * wlan_objmgr_notify_destroy() - remove 43 * logically deleted object from list 44 * @obj: object to be removed 45 * @obj_type: type of object to be removed 46 * 47 * Return: void 48 */ 49 void wlan_objmgr_notify_destroy(void *obj, 50 enum wlan_objmgr_obj_type obj_type); 51 52 /** 53 * wlan_objmgr_debug_info_init() - initialize 54 * the logically deleted list object 55 * Caller need to protect with global object lock 56 * 57 * Return: void 58 */ 59 void wlan_objmgr_debug_info_init(void); 60 61 /** 62 * wlan_objmgr_debug_info_deinit() - deinitialize 63 * the logically deleted list object 64 * 65 * Return: void 66 */ 67 void wlan_objmgr_debug_info_deinit(void); 68 69 70 #else 71 72 static inline void 73 wlan_objmgr_notify_log_delete(void *obj, 74 enum wlan_objmgr_obj_type obj_type) 75 { 76 } 77 78 static inline void 79 wlan_objmgr_notify_destroy(void *obj, 80 enum wlan_objmgr_obj_type obj_typ) 81 { 82 } 83 84 static inline void 85 wlan_objmgr_debug_info_init(void) 86 { 87 } 88 89 static inline void 90 wlan_objmgr_debug_info_deinit(void) 91 { 92 } 93 94 #endif /*WLAN_OBJMGR_DEBUG*/ 95 96 #ifdef WLAN_OBJMGR_REF_ID_TRACE 97 /** 98 * wlan_objmgr_trace_ref() - Save trace info to list 99 * @func_head: head object of function list 100 * @trace: trace object 101 * @func: function name 102 * @line: line number 103 * 104 * API to trace func and line information for reference 105 * and dereference 106 * 107 * Return: void 108 */ 109 void 110 wlan_objmgr_trace_ref(struct wlan_objmgr_trace_func **func_head, 111 struct wlan_objmgr_trace *trace, 112 const char *func, int line); 113 114 /** 115 * wlan_objmgr_trace_init_lock() - Initialize trace spinlock 116 * @trace: trace object 117 * 118 * API to initialize trace spin lock 119 * 120 * Return: void 121 */ 122 void wlan_objmgr_trace_init_lock(struct wlan_objmgr_trace *trace); 123 124 /** 125 * wlan_objmgr_trace_deinit_lock() - Deinitialize trace spinlock 126 * @trace: trace object 127 * 128 * API to deinitialize trace spin lock 129 * 130 * Return: void 131 */ 132 void wlan_objmgr_trace_deinit_lock(struct wlan_objmgr_trace *trace); 133 134 /** 135 * wlan_objmgr_trace_del_ref_list() - Delete reference trace list 136 * @trace: trace object 137 * 138 * API to delete trace list 139 * 140 * Return: void 141 */ 142 void wlan_objmgr_trace_del_ref_list(struct wlan_objmgr_trace *trace); 143 #endif /*WLAN_OBJMGR_REF_ID_TRACE*/ 144 145 #endif /*_WLAN_OBJMGR_DEBUG_H_*/ 146