Search Linux Wireless

[RFC v1 054/256] cl8k: add debug.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Viktor Barna <viktor.barna@xxxxxxxxxx>

(Part of the split. Please, take a look at the cover letter for more
details).

Signed-off-by: Viktor Barna <viktor.barna@xxxxxxxxxx>
---
 drivers/net/wireless/celeno/cl8k/debug.h | 121 +++++++++++++++++++++++
 1 file changed, 121 insertions(+)
 create mode 100644 drivers/net/wireless/celeno/cl8k/debug.h

diff --git a/drivers/net/wireless/celeno/cl8k/debug.h b/drivers/net/wireless/celeno/cl8k/debug.h
new file mode 100644
index 000000000000..f51591755051
--- /dev/null
+++ b/drivers/net/wireless/celeno/cl8k/debug.h
@@ -0,0 +1,121 @@
+/* SPDX-License-Identifier: MIT */
+/* Copyright(c) 2019-2021, Celeno Communications Ltd. */
+
+#ifndef CL_DEBUG_H
+#define CL_DEBUG_H
+
+#include <linux/string.h>
+
+enum cl_dbg_level {
+       DBG_LVL_VERBOSE,
+       DBG_LVL_ERROR,
+       DBG_LVL_WARNING,
+       DBG_LVL_TRACE,
+       DBG_LVL_INFO,
+
+       DBG_LVL_MAX,
+};
+
+#define CL_DBG(cl_hw, lvl, fmt, ...) \
+do { \
+       if ((lvl) <= (cl_hw)->conf->ce_debug_level) \
+               pr_debug("[tcv%u][%s][%d] " fmt, (cl_hw)->idx, __func__, __LINE__, ##__VA_ARGS__); \
+} while (0)
+
+#define CL_DBG_CHIP(chip, lvl, fmt, ...) \
+do { \
+       if ((lvl) <= (chip)->conf->ce_debug_level) \
+               pr_debug("[chip%u][%s][%d] " fmt, (chip)->idx, __func__, __LINE__, ##__VA_ARGS__); \
+} while (0)
+
+#define cl_dbg_verbose(cl_hw, ...) CL_DBG((cl_hw), DBG_LVL_VERBOSE, ##__VA_ARGS__)
+#define cl_dbg_err(cl_hw, ...)     CL_DBG((cl_hw), DBG_LVL_ERROR, ##__VA_ARGS__)
+#define cl_dbg_warn(cl_hw, ...)    CL_DBG((cl_hw), DBG_LVL_WARNING, ##__VA_ARGS__)
+#define cl_dbg_trace(cl_hw, ...)   CL_DBG((cl_hw), DBG_LVL_TRACE, ##__VA_ARGS__)
+#define cl_dbg_info(cl_hw, ...)    CL_DBG((cl_hw), DBG_LVL_INFO, ##__VA_ARGS__)
+
+#define cl_dbg_chip_verbose(chip, ...) CL_DBG_CHIP((chip), DBG_LVL_VERBOSE, ##__VA_ARGS__)
+#define cl_dbg_chip_err(chip, ...)     CL_DBG_CHIP((chip), DBG_LVL_ERROR, ##__VA_ARGS__)
+#define cl_dbg_chip_warn(chip, ...)    CL_DBG_CHIP((chip), DBG_LVL_WARNING, ##__VA_ARGS__)
+#define cl_dbg_chip_trace(chip, ...)   CL_DBG_CHIP((chip), DBG_LVL_TRACE, ##__VA_ARGS__)
+#define cl_dbg_chip_info(chip, ...)    CL_DBG_CHIP((chip), DBG_LVL_INFO, ##__VA_ARGS__)
+
+static inline char *basename(const char *filename)
+{
+       char *p = strrchr(filename, '/');
+
+       return p ? p + 1 : (char *)filename;
+}
+
+#define TXT_ERROR \
+       do { \
+               pr_debug("\n"); \
+               pr_debug("#######  #####    #####     #####   #####\n"); \
+               pr_debug("#        #    #   #    #   #     #  #    #\n"); \
+               pr_debug("#        #    #   #    #   #     #  #    #\n"); \
+               pr_debug("#######  #####    #####    #     #  #####\n"); \
+               pr_debug("#        #    #   #    #   #     #  #    #\n"); \
+               pr_debug("#        #     #  #     #  #     #  #     #\n"); \
+               pr_debug("#######  #     #  #     #   #####   #     #\n"); \
+       } while (0)
+
+#define TXT_WARNING \
+       do { \
+               pr_debug("\n"); \
+               pr_debug("#       #   #####   #####    #     #  ###  #     #   #####\n"); \
+               pr_debug("#       #  #     #  #    #   ##    #   #   ##    #  #     #\n"); \
+               pr_debug("#       #  #     #  #    #   # #   #   #   # #   #  #\n"); \
+               pr_debug("#   #   #  #######  #####    #  #  #   #   #  #  #  #    ###\n"); \
+               pr_debug("#  # #  #  #     #  #    #   #   # #   #   #   # #  #     #\n"); \
+               pr_debug("# #   # #  #     #  #     #  #    ##   #   #    ##  #     #\n"); \
+               pr_debug(" #     #   #     #  #     #  #     #  ###  #     #   #####\n"); \
+       } while (0)
+
+#define INFO_CL_HW(cl_hw, ...) \
+       do { \
+               pr_debug("\n"); \
+               pr_debug("CHIP:        %u\n", (cl_hw)->chip->idx); \
+               pr_debug("TCV:         %u\n", (cl_hw)->idx); \
+               pr_debug("FILE:        %s\n", basename(__FILE__)); \
+               pr_debug("FUNCTION:    %s\n", __func__); \
+               pr_debug("LINE:        %u\n", __LINE__); \
+               pr_debug("DESCRIPTION: " __VA_ARGS__); \
+               pr_debug("\n"); \
+       } while (0)
+
+#define INFO_CHIP(chip, ...) \
+       do { \
+               pr_debug("\n"); \
+               pr_debug("CHIP:        %u\n", (chip)->idx); \
+               pr_debug("FILE:        %s\n", basename(__FILE__)); \
+               pr_debug("FUNCTION:    %s\n", __func__); \
+               pr_debug("LINE:        %u\n", __LINE__); \
+               pr_debug("DESCRIPTION: " __VA_ARGS__); \
+               pr_debug("\n"); \
+       } while (0)
+
+#define CL_DBG_ERROR(cl_hw, ...) \
+       do { \
+               TXT_ERROR; \
+               INFO_CL_HW(cl_hw, __VA_ARGS__); \
+       } while (0)
+
+#define CL_DBG_ERROR_CHIP(chip, ...) \
+       do { \
+               TXT_ERROR; \
+               INFO_CHIP(chip, __VA_ARGS__); \
+       } while (0)
+
+#define CL_DBG_WARNING(cl_hw, ...) \
+       do { \
+               TXT_WARNING; \
+               INFO_CL_HW(cl_hw, __VA_ARGS__); \
+       } while (0)
+
+#define CL_DBG_WARNING_CHIP(chip, ...) \
+       do { \
+               TXT_WARNING; \
+               INFO_CHIP(chip, __VA_ARGS__); \
+       } while (0)
+
+#endif /* CL_DEBUG_H */
--
2.30.0

________________________________
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any retransmission, dissemination, copying or other use of, or taking of any action in reliance upon this information is prohibited. If you received this in error, please contact the sender and delete the material from any computer. Nothing contained herein shall be deemed as a representation, warranty or a commitment by Celeno. No warranties are expressed or implied, including, but not limited to, any implied warranties of non-infringement, merchantability and fitness for a particular purpose.
________________________________





[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux