1 // SPDX-License-Identifier: BSD-3-Clause-Clear
3 * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
6 #include <linux/vmalloc.h>
10 void ath11k_info(struct ath11k_base *ab, const char *fmt, ...)
12 struct va_format vaf = {
19 dev_info(ab->dev, "%pV", &vaf);
20 trace_ath11k_log_info(ab, &vaf);
23 EXPORT_SYMBOL(ath11k_info);
25 void ath11k_err(struct ath11k_base *ab, const char *fmt, ...)
27 struct va_format vaf = {
34 dev_err(ab->dev, "%pV", &vaf);
35 trace_ath11k_log_err(ab, &vaf);
38 EXPORT_SYMBOL(ath11k_err);
40 void ath11k_warn(struct ath11k_base *ab, const char *fmt, ...)
42 struct va_format vaf = {
49 dev_warn_ratelimited(ab->dev, "%pV", &vaf);
50 trace_ath11k_log_warn(ab, &vaf);
53 EXPORT_SYMBOL(ath11k_warn);
55 #ifdef CONFIG_ATH11K_DEBUG
57 void __ath11k_dbg(struct ath11k_base *ab, enum ath11k_debug_mask mask,
68 if (ath11k_debug_mask & mask)
69 dev_printk(KERN_DEBUG, ab->dev, "%pV", &vaf);
71 trace_ath11k_log_dbg(ab, mask, &vaf);
75 EXPORT_SYMBOL(__ath11k_dbg);
77 void ath11k_dbg_dump(struct ath11k_base *ab,
78 enum ath11k_debug_mask mask,
79 const char *msg, const char *prefix,
80 const void *buf, size_t len)
86 if (ath11k_debug_mask & mask) {
88 __ath11k_dbg(ab, mask, "%s\n", msg);
90 for (ptr = buf; (ptr - buf) < len; ptr += 16) {
92 linebuflen += scnprintf(linebuf + linebuflen,
93 sizeof(linebuf) - linebuflen,
95 (prefix ? prefix : ""),
96 (unsigned int)(ptr - buf));
97 hex_dump_to_buffer(ptr, len - (ptr - buf), 16, 1,
99 sizeof(linebuf) - linebuflen, true);
100 dev_printk(KERN_DEBUG, ab->dev, "%s\n", linebuf);
104 /* tracing code doesn't like null strings */
105 trace_ath11k_log_dbg_dump(ab, msg ? msg : "", prefix ? prefix : "",
108 EXPORT_SYMBOL(ath11k_dbg_dump);
110 #endif /* CONFIG_ATH11K_DEBUG */