1 // SPDX-License-Identifier: BSD-3-Clause-Clear
3 * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
4 * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
7 #include <linux/vmalloc.h>
11 void ath11k_info(struct ath11k_base *ab, const char *fmt, ...)
13 struct va_format vaf = {
20 dev_info(ab->dev, "%pV", &vaf);
21 trace_ath11k_log_info(ab, &vaf);
24 EXPORT_SYMBOL(ath11k_info);
26 void ath11k_err(struct ath11k_base *ab, const char *fmt, ...)
28 struct va_format vaf = {
35 dev_err(ab->dev, "%pV", &vaf);
36 trace_ath11k_log_err(ab, &vaf);
39 EXPORT_SYMBOL(ath11k_err);
41 void ath11k_warn(struct ath11k_base *ab, const char *fmt, ...)
43 struct va_format vaf = {
50 dev_warn_ratelimited(ab->dev, "%pV", &vaf);
51 trace_ath11k_log_warn(ab, &vaf);
54 EXPORT_SYMBOL(ath11k_warn);
56 #ifdef CONFIG_ATH11K_DEBUG
58 void __ath11k_dbg(struct ath11k_base *ab, enum ath11k_debug_mask mask,
69 if (ath11k_debug_mask & mask)
70 dev_printk(KERN_DEBUG, ab->dev, "%s %pV", ath11k_dbg_str(mask), &vaf);
72 trace_ath11k_log_dbg(ab, mask, &vaf);
76 EXPORT_SYMBOL(__ath11k_dbg);
78 void ath11k_dbg_dump(struct ath11k_base *ab,
79 enum ath11k_debug_mask mask,
80 const char *msg, const char *prefix,
81 const void *buf, size_t len)
87 if (ath11k_debug_mask & mask) {
89 __ath11k_dbg(ab, mask, "%s\n", msg);
91 for (ptr = buf; (ptr - buf) < len; ptr += 16) {
93 linebuflen += scnprintf(linebuf + linebuflen,
94 sizeof(linebuf) - linebuflen,
96 (prefix ? prefix : ""),
97 (unsigned int)(ptr - buf));
98 hex_dump_to_buffer(ptr, len - (ptr - buf), 16, 1,
100 sizeof(linebuf) - linebuflen, true);
101 dev_printk(KERN_DEBUG, ab->dev, "%s\n", linebuf);
105 /* tracing code doesn't like null strings */
106 trace_ath11k_log_dbg_dump(ab, msg ? msg : "", prefix ? prefix : "",
109 EXPORT_SYMBOL(ath11k_dbg_dump);
111 #endif /* CONFIG_ATH11K_DEBUG */