Part of the split. Please, take a look at the cover letter for more details Reviewed-by: Viktor Barna <viktor.barna.rj@xxxxxxxxxxxxxx> Reviewed-by: Gal Gur <gal.gur.jx@xxxxxxxxxxx> Signed-off-by: Alexander Savchenko <oleksandr.savchenko.dn@xxxxxxxxxxxxxx> --- drivers/net/wireless/renesas/ra6w/dbg.h | 47 +++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 drivers/net/wireless/renesas/ra6w/dbg.h diff --git a/drivers/net/wireless/renesas/ra6w/dbg.h b/drivers/net/wireless/renesas/ra6w/dbg.h new file mode 100644 index 000000000000..2609f4d4003d --- /dev/null +++ b/drivers/net/wireless/renesas/ra6w/dbg.h @@ -0,0 +1,47 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (C) [2022-2025] Renesas Electronics Corporation and/or its affiliates. + */ + +#ifndef RA6W_DBG_H +#define RA6W_DBG_H + +#include <linux/types.h> +#include <linux/printk.h> + +enum ra6w_dbg_level { + RA6W_DBG_LVL_OFF, + RA6W_DBG_LVL_ERROR, + RA6W_DBG_LVL_WARN, + RA6W_DBG_LVL_INFO, + RA6W_DBG_LVL_DEBUG, + RA6W_DBG_LVL_TRACE, + RA6W_DBG_LVL_VERBOSE, + + RA6W_DBG_LVL_MAX, + RA6W_DBG_LVL_LAST = RA6W_DBG_LVL_MAX - 1 +}; + +#define RA6W_DEFAULT_LOG_LVL RA6W_DBG_LVL_INFO + +#define RA6W_PRINT(level, type, fmt, arg...) \ +do { \ + if ((level) <= ra6w_params_log_level()) \ + pr_##type("%s" fmt, THIS_MODULE->name, ##arg); \ +} while (0) + +#define ra6w_err(fmt, arg...) RA6W_PRINT(RA6W_DBG_LVL_ERROR, err, " E: " fmt, ##arg) +#define ra6w_warn(fmt, arg...) RA6W_PRINT(RA6W_DBG_LVL_WARN, warn, " W: " fmt, ##arg) +#define ra6w_info(fmt, arg...) RA6W_PRINT(RA6W_DBG_LVL_INFO, info, " I: " fmt, ##arg) +#define ra6w_trace(fmt, arg...) RA6W_PRINT(RA6W_DBG_LVL_TRACE, debug, " T: " fmt, ##arg) +#define ra6w_dbg(fmt, arg...) RA6W_PRINT(RA6W_DBG_LVL_DEBUG, debug, " D: " fmt, ##arg) + +#define RA6W_SET_DBG_LEVEL(level) \ +do { \ + if ((level) >= RA6W_DBG_LVL_OFF && level <= RA6W_DBG_LVL_LAST) \ + ra6w_params_log_level_set(level); \ +} while (0) + +#define RA6W_MAC_ADDR_STR_LEN sizeof("xx:xx:xx:xx:xx:xx") + +#endif /* RA6W_DBG_H */ -- 2.17.1