1 /*
2  * Copyright (c) 2013-2016 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 #ifndef _DEBUG_LINUX_H_
20 #define _DEBUG_LINUX_H_
21 
22 /* macro to remove parens */
23 #define ATH_PRINTX_ARG(arg ...) arg
24 
25 #ifdef WLAN_DEBUG
26 /* NOTE: the AR_DEBUG_PRINTF macro is defined here to handle special handling of variable arg macros
27  * which may be compiler dependent. */
28 #define AR_DEBUG_PRINTF(mask, args) do {	\
29 		if (GET_ATH_MODULE_DEBUG_VAR_MASK(ATH_MODULE_NAME) & (mask)) {			  \
30 			A_LOGGER(mask, ATH_MODULE_NAME, ATH_PRINTX_ARG args);	 \
31 		}					     \
32 } while (0)
33 #else
34 /* on non-debug builds, keep in error and warning messages in the driver, all other
35  * message tracing will get compiled out */
36 #define AR_DEBUG_PRINTF(mask, args) \
37 	if ((mask) & (ATH_DEBUG_ERR | ATH_DEBUG_WARN)) { A_PRINTF(ATH_PRINTX_ARG args); }
38 
39 #endif
40 
41 #endif /* _DEBUG_LINUX_H_ */
42