1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * This file is part of wl12xx
5 * Copyright (C) 2011 Texas Instruments. All rights reserved.
6 * Copyright (C) 2008-2009 Nokia Corporation
8 * Contact: Luciano Coelho <coelho@ti.com>
14 #include <linux/bitops.h>
15 #include <linux/printk.h>
17 #define DRIVER_NAME "wlcore"
18 #define DRIVER_PREFIX DRIVER_NAME ": "
25 DEBUG_MAILBOX
= BIT(3),
26 DEBUG_TESTMODE
= BIT(4),
33 DEBUG_MAC80211
= BIT(11),
37 DEBUG_FILTERS
= BIT(15),
38 DEBUG_ADHOC
= BIT(16),
40 DEBUG_PROBE
= BIT(18),
42 DEBUG_MASTER
= (DEBUG_ADHOC
| DEBUG_AP
),
46 extern u32 wl12xx_debug_level
;
48 #define DEBUG_DUMP_LIMIT 1024
50 #define wl1271_error(fmt, arg...) \
51 pr_err(DRIVER_PREFIX "ERROR " fmt "\n", ##arg)
53 #define wl1271_warning(fmt, arg...) \
54 pr_warn(DRIVER_PREFIX "WARNING " fmt "\n", ##arg)
56 #define wl1271_notice(fmt, arg...) \
57 pr_info(DRIVER_PREFIX fmt "\n", ##arg)
59 #define wl1271_info(fmt, arg...) \
60 pr_info(DRIVER_PREFIX fmt "\n", ##arg)
62 /* define the debug macro differently if dynamic debug is supported */
63 #if defined(CONFIG_DYNAMIC_DEBUG)
64 #define wl1271_debug(level, fmt, arg...) \
66 if (unlikely(level & wl12xx_debug_level)) \
67 dynamic_pr_debug(DRIVER_PREFIX fmt "\n", ##arg); \
70 #define wl1271_debug(level, fmt, arg...) \
72 if (unlikely(level & wl12xx_debug_level)) \
73 printk(KERN_DEBUG pr_fmt(DRIVER_PREFIX fmt "\n"), \
78 #define wl1271_dump(level, prefix, buf, len) \
80 if (level & wl12xx_debug_level) \
81 print_hex_dump_debug(DRIVER_PREFIX prefix, \
82 DUMP_PREFIX_OFFSET, 16, 1, \
84 min_t(size_t, len, DEBUG_DUMP_LIMIT), \
88 #define wl1271_dump_ascii(level, prefix, buf, len) \
90 if (level & wl12xx_debug_level) \
91 print_hex_dump_debug(DRIVER_PREFIX prefix, \
92 DUMP_PREFIX_OFFSET, 16, 1, \
94 min_t(size_t, len, DEBUG_DUMP_LIMIT), \
98 #endif /* __DEBUG_H__ */