linux/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h

// SPDX-License-Identifier: ISC
/*
 * Copyright (c) 2010 Broadcom Corporation
 */

#ifndef BRCMFMAC_DEBUG_H
#define BRCMFMAC_DEBUG_H

#include <linux/net.h>	/* net_ratelimit() */

/* message levels */
#define BRCMF_TRACE_VAL
#define BRCMF_INFO_VAL
#define BRCMF_DATA_VAL
#define BRCMF_CTL_VAL
#define BRCMF_TIMER_VAL
#define BRCMF_HDRS_VAL
#define BRCMF_BYTES_VAL
#define BRCMF_INTR_VAL
#define BRCMF_GLOM_VAL
#define BRCMF_EVENT_VAL
#define BRCMF_BTA_VAL
#define BRCMF_FIL_VAL
#define BRCMF_USB_VAL
#define BRCMF_SCAN_VAL
#define BRCMF_CONN_VAL
#define BRCMF_BCDC_VAL
#define BRCMF_SDIO_VAL
#define BRCMF_MSGBUF_VAL
#define BRCMF_PCIE_VAL
#define BRCMF_FWCON_VAL

/* set default print format */
#undef pr_fmt
#define pr_fmt(fmt)

struct brcmf_bus;

__printf(3, 4)
void __brcmf_err(struct brcmf_bus *bus, const char *func, const char *fmt, ...);
/* Macro for error messages. When debugging / tracing the driver all error
 * messages are important to us.
 */
#ifndef brcmf_err
#define brcmf_err(fmt, ...)
#endif

#define bphy_err(drvr, fmt, ...)

#define bphy_info_once(drvr, fmt, ...)

#if defined(DEBUG) || defined(CONFIG_BRCM_TRACING)

/* For debug/tracing purposes treat info messages as errors */
#define brcmf_info

__printf(3, 4)
void __brcmf_dbg(u32 level, const char *func, const char *fmt, ...);
#define brcmf_dbg(level, fmt, ...)
#define BRCMF_DATA_ON()
#define BRCMF_CTL_ON()
#define BRCMF_HDRS_ON()
#define BRCMF_BYTES_ON()
#define BRCMF_GLOM_ON()
#define BRCMF_EVENT_ON()
#define BRCMF_FIL_ON()
#define BRCMF_FWCON_ON()
#define BRCMF_SCAN_ON()

#else /* defined(DEBUG) || defined(CONFIG_BRCM_TRACING) */

#define brcmf_info

#define brcmf_dbg

#define BRCMF_DATA_ON
#define BRCMF_CTL_ON
#define BRCMF_HDRS_ON
#define BRCMF_BYTES_ON
#define BRCMF_GLOM_ON
#define BRCMF_EVENT_ON
#define BRCMF_FIL_ON
#define BRCMF_FWCON_ON
#define BRCMF_SCAN_ON

#endif /* defined(DEBUG) || defined(CONFIG_BRCM_TRACING) */

#define brcmf_dbg_hex_dump(test, data, len, fmt, ...)

extern int brcmf_msg_level;

struct brcmf_pub;
#ifdef DEBUG
struct dentry *brcmf_debugfs_get_devdir(struct brcmf_pub *drvr);
void brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn,
			     int (*read_fn)(struct seq_file *seq, void *data));
int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data,
			       size_t len);
#else
static inline struct dentry *brcmf_debugfs_get_devdir(struct brcmf_pub *drvr)
{
	return ERR_PTR(-ENOENT);
}
static inline
void brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn,
			     int (*read_fn)(struct seq_file *seq, void *data))
{ }
static inline
int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data,
			       size_t len)
{
	return 0;
}
#endif

#endif /* BRCMFMAC_DEBUG_H */