Skip to content
This repository has been archived by the owner on Oct 28, 2022. It is now read-only.

Commit

Permalink
qcacmn: Disable all of qdf_trace when WLAN_DEBUG is disabled
Browse files Browse the repository at this point in the history
Some parts of qcacld-3.0 still print their garbage to dmesg even when
WLAN_DEBUG is disabled because the qdf_trace utilities are still
available. Compiling out qdf_trace when WLAN_DEBUG is off fixes that up
nicely.

Signed-off-by: Sultan Alsawaf <[email protected]>
  • Loading branch information
kerneltoast authored and YaroST12 committed Jan 17, 2021
1 parent 22cf0a6 commit 3c09d61
Show file tree
Hide file tree
Showing 2 changed files with 138 additions and 0 deletions.
136 changes: 136 additions & 0 deletions drivers/staging/qca-wifi-host-cmn/qdf/inc/qdf_trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -967,6 +967,7 @@ void qdf_dp_log_proto_pkt_info(uint8_t *sa, uint8_t *da, uint8_t type,
}
#endif

#ifdef WLAN_DEBUG
void qdf_trace_display(void);

void qdf_trace_set_value(QDF_MODULE_ID module, QDF_TRACE_LEVEL level,
Expand All @@ -976,6 +977,29 @@ void qdf_trace_set_module_trace_level(QDF_MODULE_ID module, uint32_t level);

void __printf(3, 4) qdf_snprintf(char *str_buffer, unsigned int size,
char *str_format, ...);
#else
static inline
void qdf_trace_display(void)
{
}

static inline
void qdf_trace_set_value(QDF_MODULE_ID module, QDF_TRACE_LEVEL level,
uint8_t on)
{
}

static inline
void qdf_trace_set_module_trace_level(QDF_MODULE_ID module, uint32_t level)
{
}

static inline
void __printf(3, 4) qdf_snprintf(char *str_buffer, unsigned int size,
char *str_format, ...)
{
}
#endif

#define QDF_SNPRINTF qdf_snprintf

Expand Down Expand Up @@ -1102,15 +1126,24 @@ qdf_tso_seg_dbg_zero(struct qdf_tso_seg_elem_t *tsoseg)

#endif /* TSOSEG_DEBUG */

#ifdef WLAN_DEBUG
void qdf_trace_hex_dump(QDF_MODULE_ID module, QDF_TRACE_LEVEL level,
void *data, int buf_len);
#else
static inline
void qdf_trace_hex_dump(QDF_MODULE_ID module, QDF_TRACE_LEVEL level,
void *data, int buf_len)
{
}
#endif

#define ERROR_CODE -1
#define QDF_MAX_NAME_SIZE 32
#define MAX_PRINT_CONFIG_SUPPORTED 32

#define MAX_SUPPORTED_CATEGORY QDF_MODULE_ID_MAX

#ifdef WLAN_DEBUG
/**
* qdf_set_pidx() - Sets the global qdf_pidx.
* @pidx : Index of print control object assigned to the module
Expand All @@ -1128,9 +1161,22 @@ int qdf_get_pidx(void);
* Shared print control index
* for converged debug framework
*/
#else
static inline
void qdf_set_pidx(int pidx)
{
}

static inline
int qdf_get_pidx(void)
{
return 0;
}
#endif /* WLAN_DEBUG */

#define QDF_PRINT_IDX_SHARED -1

#ifdef WLAN_DEBUG
/**
* QDF_PRINT_INFO() - Generic wrapper API for logging
* @idx : Index of print control object
Expand All @@ -1151,6 +1197,14 @@ int qdf_get_pidx(void);
void QDF_PRINT_INFO(unsigned int idx, QDF_MODULE_ID module,
QDF_TRACE_LEVEL level,
char *str_format, ...);
#else
static inline
void QDF_PRINT_INFO(unsigned int idx, QDF_MODULE_ID module,
QDF_TRACE_LEVEL level,
char *str_format, ...)
{
}
#endif /* WLAN_DEBUG */

/**
* struct category_info : Category information structure
Expand Down Expand Up @@ -1219,6 +1273,7 @@ struct qdf_print_ctrl {
bool in_use;
};

#ifdef WLAN_DEBUG
/**
* qdf_print_ctrl_register() - Allocate QDF print control object, assign
* pointer to category info or print control
Expand Down Expand Up @@ -1330,6 +1385,67 @@ static inline bool qdf_print_is_verbose_enabled(unsigned int idx,
* Return : None
*/
void qdf_print_clean_node_flag(unsigned int idx);
#else
static inline
int qdf_print_ctrl_register(const struct category_info *cinfo,
void *custom_print_handler,
void *custom_ctx,
const char *pctrl_name)
{
return 0;
}

static inline
void qdf_shared_print_ctrl_init(void)
{
}

static inline
QDF_STATUS qdf_print_setup(void)
{
return 0;
}

static inline
QDF_STATUS qdf_print_ctrl_cleanup(unsigned int idx)
{
return 0;
}

static inline
void qdf_shared_print_ctrl_cleanup(void)
{
}

static inline
QDF_STATUS qdf_print_set_category_verbose(unsigned int idx,
QDF_MODULE_ID category,
QDF_TRACE_LEVEL verbose,
bool is_set)
{
return 0;
}

static inline
bool qdf_print_is_category_enabled(unsigned int idx,
QDF_MODULE_ID category)
{
return false;
}

static inline
bool qdf_print_is_verbose_enabled(unsigned int idx,
QDF_MODULE_ID category,
QDF_TRACE_LEVEL verbose)
{
return false;
}

static inline
void qdf_print_clean_node_flag(unsigned int idx)
{
}
#endif /* WLAN_DEBUG */

#ifdef DBG_LVL_MAC_FILTERING

Expand All @@ -1355,6 +1471,7 @@ bool qdf_print_get_node_flag(unsigned int idx);

#endif

#ifdef WLAN_DEBUG
/**
* qdf_logging_init() - Initialize msg logging functionality
*
Expand All @@ -1370,9 +1487,21 @@ void qdf_logging_init(void);
* Return : void
*/
void qdf_logging_exit(void);
#else
static inline
void qdf_logging_init(void)
{
}

static inline
void qdf_logging_exit(void)
{
}
#endif /* WLAN_DEBUG */

#define QDF_SYMBOL_LEN __QDF_SYMBOL_LEN

#ifdef WLAN_DEBUG
/**
* qdf_sprint_symbol() - prints the name of a symbol into a string buffer
* @buffer: the string buffer to print into
Expand All @@ -1381,5 +1510,12 @@ void qdf_logging_exit(void);
* Return: number of characters printed
*/
int qdf_sprint_symbol(char *buffer, void *addr);
#else
static inline
int qdf_sprint_symbol(char *buffer, void *addr)
{
return 0;
}
#endif /* WLAN_DEBUG */

#endif /* __QDF_TRACE_H */
2 changes: 2 additions & 0 deletions drivers/staging/qca-wifi-host-cmn/qdf/linux/src/qdf_trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* Trace, logging, and debugging definitions and APIs
*/

#ifdef WLAN_DEBUG
/* Include Files */
#include "qdf_str.h"
#include <qdf_trace.h>
Expand Down Expand Up @@ -3879,4 +3880,5 @@ void __qdf_bug(void)
qdf_export_symbol(__qdf_bug);
#endif /* CONFIG_SLUB_DEBUG */
#endif /* PANIC_ON_BUG */
#endif /* WLAN_DEBUG */

0 comments on commit 3c09d61

Please sign in to comment.