2 * Intel Wireless Multicomm 3200 WiFi driver
4 * Copyright (C) 2009 Intel Corporation <ilw@linux.intel.com>
5 * Samuel Ortiz <samuel.ortiz@intel.com>
6 * Zhu Yi <yi.zhu@intel.com>
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License version
10 * 2 as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 #ifndef __IWM_DEBUG_H__
25 #define __IWM_DEBUG_H__
27 #define IWM_ERR(p, f, a...) dev_err(iwm_to_dev(p), f, ## a)
28 #define IWM_WARN(p, f, a...) dev_warn(iwm_to_dev(p), f, ## a)
29 #define IWM_INFO(p, f, a...) dev_info(iwm_to_dev(p), f, ## a)
30 #define IWM_CRIT(p, f, a...) dev_crit(iwm_to_dev(p), f, ## a)
32 #ifdef CONFIG_IWM_DEBUG
34 #define IWM_DEBUG_MODULE(i, level, module, f, a...) \
36 if (unlikely(i->dbg.dbg_module[IWM_DM_##module] >= (IWM_DL_##level)))\
37 dev_printk(KERN_INFO, (iwm_to_dev(i)), \
38 "%s " f, __func__ , ## a); \
41 #define IWM_HEXDUMP(i, level, module, pref, buf, len) \
43 if (unlikely(i->dbg.dbg_module[IWM_DM_##module] >= (IWM_DL_##level)))\
44 print_hex_dump(KERN_INFO, pref, DUMP_PREFIX_OFFSET, \
45 16, 1, buf, len, 1); \
50 #define IWM_DEBUG_MODULE(i, level, module, f, a...)
51 #define IWM_HEXDUMP(i, level, module, pref, buf, len)
53 #endif /* CONFIG_IWM_DEBUG */
56 enum iwm_debug_module_id {
68 #define IWM_DM_DEFAULT 0
70 #define IWM_DBG_BOOT(i, l, f, a...) IWM_DEBUG_MODULE(i, l, BOOT, f, ## a)
71 #define IWM_DBG_FW(i, l, f, a...) IWM_DEBUG_MODULE(i, l, FW, f, ## a)
72 #define IWM_DBG_SDIO(i, l, f, a...) IWM_DEBUG_MODULE(i, l, SDIO, f, ## a)
73 #define IWM_DBG_NTF(i, l, f, a...) IWM_DEBUG_MODULE(i, l, NTF, f, ## a)
74 #define IWM_DBG_RX(i, l, f, a...) IWM_DEBUG_MODULE(i, l, RX, f, ## a)
75 #define IWM_DBG_TX(i, l, f, a...) IWM_DEBUG_MODULE(i, l, TX, f, ## a)
76 #define IWM_DBG_MLME(i, l, f, a...) IWM_DEBUG_MODULE(i, l, MLME, f, ## a)
77 #define IWM_DBG_CMD(i, l, f, a...) IWM_DEBUG_MODULE(i, l, CMD, f, ## a)
78 #define IWM_DBG_WEXT(i, l, f, a...) IWM_DEBUG_MODULE(i, l, WEXT, f, ## a)
81 enum iwm_debug_level {
88 #define IWM_DL_DEFAULT IWM_DL_ERR
92 struct dentry *rootdir;
93 struct dentry *devdir;
94 struct dentry *dbgdir;
97 struct dentry *busdir;
100 struct dentry *dbg_level_dentry;
102 unsigned long dbg_modules;
103 struct dentry *dbg_modules_dentry;
105 u8 dbg_module[__IWM_DM_NR];
106 struct dentry *dbg_module_dentries[__IWM_DM_NR];
108 struct dentry *txq_dentry;
109 struct dentry *tx_credit_dentry;
110 struct dentry *rx_ticket_dentry;
113 #ifdef CONFIG_IWM_DEBUG
114 int iwm_debugfs_init(struct iwm_priv *iwm);
115 void iwm_debugfs_exit(struct iwm_priv *iwm);
117 static inline int iwm_debugfs_init(struct iwm_priv *iwm)
121 static inline void iwm_debugfs_exit(struct iwm_priv *iwm) {}