drm: bridge: adv7511: remove s32 format from i2s capabilities
[drm/drm-misc.git] / drivers / net / wireless / ath / ath12k / debug.c
blobfe5a732ba9ec94fc0350e3c471d1315b8216abf3
1 // SPDX-License-Identifier: BSD-3-Clause-Clear
2 /*
3 * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
4 * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
5 */
7 #include <linux/vmalloc.h>
8 #include "core.h"
9 #include "debug.h"
11 void ath12k_info(struct ath12k_base *ab, const char *fmt, ...)
13 struct va_format vaf = {
14 .fmt = fmt,
16 va_list args;
18 va_start(args, fmt);
19 vaf.va = &args;
20 dev_info(ab->dev, "%pV", &vaf);
21 /* TODO: Trace the log */
22 va_end(args);
25 void ath12k_err(struct ath12k_base *ab, const char *fmt, ...)
27 struct va_format vaf = {
28 .fmt = fmt,
30 va_list args;
32 va_start(args, fmt);
33 vaf.va = &args;
34 dev_err(ab->dev, "%pV", &vaf);
35 /* TODO: Trace the log */
36 va_end(args);
39 void ath12k_warn(struct ath12k_base *ab, const char *fmt, ...)
41 struct va_format vaf = {
42 .fmt = fmt,
44 va_list args;
46 va_start(args, fmt);
47 vaf.va = &args;
48 dev_warn_ratelimited(ab->dev, "%pV", &vaf);
49 /* TODO: Trace the log */
50 va_end(args);
53 #ifdef CONFIG_ATH12K_DEBUG
55 void __ath12k_dbg(struct ath12k_base *ab, enum ath12k_debug_mask mask,
56 const char *fmt, ...)
58 struct va_format vaf;
59 va_list args;
61 va_start(args, fmt);
63 vaf.fmt = fmt;
64 vaf.va = &args;
66 if (ath12k_debug_mask & mask)
67 dev_printk(KERN_DEBUG, ab->dev, "%pV", &vaf);
69 /* TODO: trace log */
71 va_end(args);
74 void ath12k_dbg_dump(struct ath12k_base *ab,
75 enum ath12k_debug_mask mask,
76 const char *msg, const char *prefix,
77 const void *buf, size_t len)
79 char linebuf[256];
80 size_t linebuflen;
81 const void *ptr;
83 if (ath12k_debug_mask & mask) {
84 if (msg)
85 __ath12k_dbg(ab, mask, "%s\n", msg);
87 for (ptr = buf; (ptr - buf) < len; ptr += 16) {
88 linebuflen = 0;
89 linebuflen += scnprintf(linebuf + linebuflen,
90 sizeof(linebuf) - linebuflen,
91 "%s%08x: ",
92 (prefix ? prefix : ""),
93 (unsigned int)(ptr - buf));
94 hex_dump_to_buffer(ptr, len - (ptr - buf), 16, 1,
95 linebuf + linebuflen,
96 sizeof(linebuf) - linebuflen, true);
97 dev_dbg(ab->dev, "%s\n", linebuf);
102 #endif /* CONFIG_ATH12K_DEBUG */