diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-debug.h')
| -rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-debug.h | 84 | 
1 files changed, 42 insertions, 42 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.h b/drivers/net/wireless/iwlwifi/iwl-debug.h index 351b41d7f4f..01b23303d73 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debug.h +++ b/drivers/net/wireless/iwlwifi/iwl-debug.h @@ -29,16 +29,34 @@  #ifndef __iwl_debug_h__  #define __iwl_debug_h__ -#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 +64,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 */  |