0001
0002
0003
0004
0005 #include <linux/device.h>
0006 #include <linux/interrupt.h>
0007 #include <linux/export.h>
0008 #include "iwl-drv.h"
0009 #include "iwl-debug.h"
0010 #include "iwl-devtrace.h"
0011
0012 #define __iwl_fn(fn) \
0013 void __iwl_ ##fn(struct device *dev, const char *fmt, ...) \
0014 { \
0015 struct va_format vaf = { \
0016 .fmt = fmt, \
0017 }; \
0018 va_list args; \
0019 \
0020 va_start(args, fmt); \
0021 vaf.va = &args; \
0022 dev_ ##fn(dev, "%pV", &vaf); \
0023 trace_iwlwifi_ ##fn(&vaf); \
0024 va_end(args); \
0025 }
0026
0027 __iwl_fn(warn)
0028 IWL_EXPORT_SYMBOL(__iwl_warn);
0029 __iwl_fn(info)
0030 IWL_EXPORT_SYMBOL(__iwl_info);
0031 __iwl_fn(crit)
0032 IWL_EXPORT_SYMBOL(__iwl_crit);
0033
0034 void __iwl_err(struct device *dev, enum iwl_err_mode mode, const char *fmt, ...)
0035 {
0036 struct va_format vaf = {
0037 .fmt = fmt,
0038 };
0039 va_list args, args2;
0040
0041 va_start(args, fmt);
0042 switch (mode) {
0043 case IWL_ERR_MODE_RATELIMIT:
0044 if (net_ratelimit())
0045 break;
0046 fallthrough;
0047 case IWL_ERR_MODE_REGULAR:
0048 case IWL_ERR_MODE_RFKILL:
0049 va_copy(args2, args);
0050 vaf.va = &args2;
0051 if (mode == IWL_ERR_MODE_RFKILL)
0052 dev_err(dev, "(RFKILL) %pV", &vaf);
0053 else
0054 dev_err(dev, "%pV", &vaf);
0055 va_end(args2);
0056 break;
0057 default:
0058 break;
0059 }
0060 trace_iwlwifi_err(&vaf);
0061 va_end(args);
0062 }
0063 IWL_EXPORT_SYMBOL(__iwl_err);
0064
0065 #if defined(CONFIG_IWLWIFI_DEBUG) || defined(CONFIG_IWLWIFI_DEVICE_TRACING)
0066 void __iwl_dbg(struct device *dev,
0067 u32 level, bool limit, const char *function,
0068 const char *fmt, ...)
0069 {
0070 struct va_format vaf = {
0071 .fmt = fmt,
0072 };
0073 va_list args;
0074
0075 va_start(args, fmt);
0076 vaf.va = &args;
0077 #ifdef CONFIG_IWLWIFI_DEBUG
0078 if (iwl_have_debug_level(level) &&
0079 (!limit || net_ratelimit()))
0080 dev_printk(KERN_DEBUG, dev, "%s %pV", function, &vaf);
0081 #endif
0082 trace_iwlwifi_dbg(level, function, &vaf);
0083 va_end(args);
0084 }
0085 IWL_EXPORT_SYMBOL(__iwl_dbg);
0086 #endif