0001
0002
0003
0004
0005
0006 #include <linux/vmalloc.h>
0007 #include "core.h"
0008 #include "debug.h"
0009
0010 void ath11k_info(struct ath11k_base *ab, const char *fmt, ...)
0011 {
0012 struct va_format vaf = {
0013 .fmt = fmt,
0014 };
0015 va_list args;
0016
0017 va_start(args, fmt);
0018 vaf.va = &args;
0019 dev_info(ab->dev, "%pV", &vaf);
0020 trace_ath11k_log_info(ab, &vaf);
0021 va_end(args);
0022 }
0023 EXPORT_SYMBOL(ath11k_info);
0024
0025 void ath11k_err(struct ath11k_base *ab, const char *fmt, ...)
0026 {
0027 struct va_format vaf = {
0028 .fmt = fmt,
0029 };
0030 va_list args;
0031
0032 va_start(args, fmt);
0033 vaf.va = &args;
0034 dev_err(ab->dev, "%pV", &vaf);
0035 trace_ath11k_log_err(ab, &vaf);
0036 va_end(args);
0037 }
0038 EXPORT_SYMBOL(ath11k_err);
0039
0040 void ath11k_warn(struct ath11k_base *ab, const char *fmt, ...)
0041 {
0042 struct va_format vaf = {
0043 .fmt = fmt,
0044 };
0045 va_list args;
0046
0047 va_start(args, fmt);
0048 vaf.va = &args;
0049 dev_warn_ratelimited(ab->dev, "%pV", &vaf);
0050 trace_ath11k_log_warn(ab, &vaf);
0051 va_end(args);
0052 }
0053 EXPORT_SYMBOL(ath11k_warn);
0054
0055 #ifdef CONFIG_ATH11K_DEBUG
0056
0057 void __ath11k_dbg(struct ath11k_base *ab, enum ath11k_debug_mask mask,
0058 const char *fmt, ...)
0059 {
0060 struct va_format vaf;
0061 va_list args;
0062
0063 va_start(args, fmt);
0064
0065 vaf.fmt = fmt;
0066 vaf.va = &args;
0067
0068 if (ath11k_debug_mask & mask)
0069 dev_printk(KERN_DEBUG, ab->dev, "%pV", &vaf);
0070
0071 trace_ath11k_log_dbg(ab, mask, &vaf);
0072
0073 va_end(args);
0074 }
0075 EXPORT_SYMBOL(__ath11k_dbg);
0076
0077 void ath11k_dbg_dump(struct ath11k_base *ab,
0078 enum ath11k_debug_mask mask,
0079 const char *msg, const char *prefix,
0080 const void *buf, size_t len)
0081 {
0082 char linebuf[256];
0083 size_t linebuflen;
0084 const void *ptr;
0085
0086 if (ath11k_debug_mask & mask) {
0087 if (msg)
0088 __ath11k_dbg(ab, mask, "%s\n", msg);
0089
0090 for (ptr = buf; (ptr - buf) < len; ptr += 16) {
0091 linebuflen = 0;
0092 linebuflen += scnprintf(linebuf + linebuflen,
0093 sizeof(linebuf) - linebuflen,
0094 "%s%08x: ",
0095 (prefix ? prefix : ""),
0096 (unsigned int)(ptr - buf));
0097 hex_dump_to_buffer(ptr, len - (ptr - buf), 16, 1,
0098 linebuf + linebuflen,
0099 sizeof(linebuf) - linebuflen, true);
0100 dev_printk(KERN_DEBUG, ab->dev, "%s\n", linebuf);
0101 }
0102 }
0103
0104
0105 trace_ath11k_log_dbg_dump(ab, msg ? msg : "", prefix ? prefix : "",
0106 buf, len);
0107 }
0108 EXPORT_SYMBOL(ath11k_dbg_dump);
0109
0110 #endif