1 // SPDX-License-Identifier: BSD-3-Clause-Clear
3 * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
4 * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
7 #include <linux/vmalloc.h>
11 void ath12k_info(struct ath12k_base
*ab
, const char *fmt
, ...)
13 struct va_format vaf
= {
20 dev_info(ab
->dev
, "%pV", &vaf
);
21 /* TODO: Trace the log */
25 void ath12k_err(struct ath12k_base
*ab
, const char *fmt
, ...)
27 struct va_format vaf
= {
34 dev_err(ab
->dev
, "%pV", &vaf
);
35 /* TODO: Trace the log */
39 void ath12k_warn(struct ath12k_base
*ab
, const char *fmt
, ...)
41 struct va_format vaf
= {
48 dev_warn_ratelimited(ab
->dev
, "%pV", &vaf
);
49 /* TODO: Trace the log */
53 #ifdef CONFIG_ATH12K_DEBUG
55 void __ath12k_dbg(struct ath12k_base
*ab
, enum ath12k_debug_mask mask
,
66 if (ath12k_debug_mask
& mask
)
67 dev_printk(KERN_DEBUG
, ab
->dev
, "%pV", &vaf
);
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
)
83 if (ath12k_debug_mask
& mask
) {
85 __ath12k_dbg(ab
, mask
, "%s\n", msg
);
87 for (ptr
= buf
; (ptr
- buf
) < len
; ptr
+= 16) {
89 linebuflen
+= scnprintf(linebuf
+ linebuflen
,
90 sizeof(linebuf
) - linebuflen
,
92 (prefix
? prefix
: ""),
93 (unsigned int)(ptr
- buf
));
94 hex_dump_to_buffer(ptr
, len
- (ptr
- buf
), 16, 1,
96 sizeof(linebuf
) - linebuflen
, true);
97 dev_dbg(ab
->dev
, "%s\n", linebuf
);
102 #endif /* CONFIG_ATH12K_DEBUG */