summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-debug.h
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-01-31 21:08:37 -0800
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2012-02-17 09:49:27 -0800
commit2655e314c4b204966008689eaf3e87ba1f38d55c (patch)
tree2d0dc33216e97e764133c7165b7ebcf4b5f16347 /drivers/net/wireless/iwlwifi/iwl-debug.h
parentcdfef6c224f9490215cadd91b34c579757a6e59d (diff)
iwlwifi: trace debug messages
Make iwlwifi record all debug messages into tracing, even if debug_level is not enabled. Due to the lack of APIs, the debug messages are now recorded up to a max length of 100, the only one above that is the RXON which is not needed if you trace the commands as well as it only dumps the command contents. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi W Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-debug.h')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debug.h83
1 files changed, 42 insertions, 41 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.h b/drivers/net/wireless/iwlwifi/iwl-debug.h
index 351b41d7f4f..bfc08494ed2 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debug.h
+++ b/drivers/net/wireless/iwlwifi/iwl-debug.h
@@ -31,14 +31,33 @@
#include "iwl-bus.h"
#include "iwl-shared.h"
+#include "iwl-devtrace.h"
struct iwl_priv;
-/*No matter what is m (priv, bus, trans), this will work */
-#define IWL_ERR(m, f, a...) dev_err(trans(m)->dev, f, ## a)
-#define IWL_WARN(m, f, a...) dev_warn(trans(m)->dev, f, ## a)
-#define IWL_INFO(m, f, a...) dev_info(trans(m)->dev, f, ## a)
-#define IWL_CRIT(m, f, a...) dev_crit(trans(m)->dev, f, ## a)
+void __iwl_err(struct device *dev, bool rfkill_prefix, bool only_trace,
+ const char *fmt, ...);
+void __iwl_warn(struct device *dev, const char *fmt, ...);
+void __iwl_info(struct device *dev, const char *fmt, ...);
+void __iwl_crit(struct device *dev, const char *fmt, ...);
+
+/* No matter what is m (priv, bus, trans), this will work */
+#define IWL_ERR(m, f, a...) __iwl_err(trans(m)->dev, false, false, f, ## a)
+#define IWL_WARN(m, f, a...) __iwl_warn(trans(m)->dev, f, ## a)
+#define IWL_INFO(m, f, a...) __iwl_info(trans(m)->dev, f, ## a)
+#define IWL_CRIT(m, f, a...) __iwl_crit(trans(m)->dev, f, ## a)
+
+#if defined(CONFIG_IWLWIFI_DEBUG) || defined(CONFIG_IWLWIFI_DEVICE_TRACING)
+void __iwl_dbg(struct iwl_shared *shared, struct device *dev,
+ u32 level, bool limit, const char *function,
+ const char *fmt, ...);
+#else
+static inline void
+__iwl_dbg(struct iwl_shared *shared, struct device *dev,
+ u32 level, bool limit, const char *function,
+ const char *fmt, ...)
+{}
+#endif
#define iwl_print_hex_error(m, p, len) \
do { \
@@ -46,53 +65,35 @@ do { \
DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \
} while (0)
-#ifdef CONFIG_IWLWIFI_DEBUG
-#define IWL_DEBUG(m, level, fmt, ...) \
-do { \
- if (iwl_get_debug_level((m)->shrd) & (level)) \
- dev_err(trans(m)->dev, "%c %s " fmt, \
- in_interrupt() ? 'I' : 'U', __func__, \
- ##__VA_ARGS__); \
-} while (0)
-
-#define IWL_DEBUG_LIMIT(m, level, fmt, ...) \
-do { \
- if (iwl_get_debug_level((m)->shrd) & (level) && \
- net_ratelimit()) \
- dev_err(trans(m)->dev, "%c %s " fmt, \
- in_interrupt() ? 'I' : 'U', __func__, \
- ##__VA_ARGS__); \
-} while (0)
+#define IWL_DEBUG(m, level, fmt, args...) \
+ __iwl_dbg((m)->shrd, trans(m)->dev, level, false, __func__, fmt, ##args)
+#define IWL_DEBUG_LIMIT(m, level, fmt, args...) \
+ __iwl_dbg((m)->shrd, trans(m)->dev, level, true, __func__, fmt, ##args)
+#ifdef CONFIG_IWLWIFI_DEBUG
#define iwl_print_hex_dump(m, level, p, len) \
do { \
if (iwl_get_debug_level((m)->shrd) & level) \
print_hex_dump(KERN_DEBUG, "iwl data: ", \
DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \
} while (0)
-
-#define IWL_DEBUG_QUIET_RFKILL(p, fmt, ...) \
+#define IWL_DEBUG_QUIET_RFKILL(m, fmt, args...) \
do { \
- if (!iwl_is_rfkill(p->shrd)) \
- dev_err(trans(p)->dev, "%s%c %s " fmt, \
- "", \
- in_interrupt() ? 'I' : 'U', __func__, \
- ##__VA_ARGS__); \
- else if (iwl_get_debug_level(p->shrd) & IWL_DL_RADIO) \
- dev_err(trans(p)->dev, "%s%c %s " fmt, \
- "(RFKILL) ", \
- in_interrupt() ? 'I' : 'U', __func__, \
- ##__VA_ARGS__); \
+ if (!iwl_is_rfkill((m)->shrd)) \
+ IWL_ERR(m, fmt, ##args); \
+ else \
+ __iwl_err(trans(m)->dev, true, \
+ !(iwl_get_debug_level((m)->shrd) & IWL_DL_RADIO),\
+ fmt, ##args); \
} while (0)
-
#else
-#define IWL_DEBUG(m, level, fmt, args...)
-#define IWL_DEBUG_LIMIT(m, level, fmt, args...)
#define iwl_print_hex_dump(m, level, p, len)
-#define IWL_DEBUG_QUIET_RFKILL(p, fmt, args...) \
-do { \
- if (!iwl_is_rfkill(p->shrd)) \
- IWL_ERR(p, fmt, ##args); \
+#define IWL_DEBUG_QUIET_RFKILL(m, fmt, args...) \
+do { \
+ if (!iwl_is_rfkill((m)->shrd)) \
+ IWL_ERR(m, fmt, ##args); \
+ else \
+ __iwl_err(trans(m)->dev, true, true, fmt, ##args); \
} while (0)
#endif /* CONFIG_IWLWIFI_DEBUG */