]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: ath12k: introduce ath12k_hw_warn()
authorKalle Valo <quic_kvalo@quicinc.com>
Fri, 1 Nov 2024 15:17:01 +0000 (17:17 +0200)
committerJeff Johnson <quic_jjohnson@quicinc.com>
Wed, 6 Nov 2024 19:36:28 +0000 (11:36 -0800)
In the following patch we need to use ath12k_warn() but don't easily have
access to struct ath12k_base (ab) but do have access to struct ath12k_hw (ah).
So add a new warning helper ath12_hw_warn() which takes the latter but the log
output is still identical but uses the struct device pointer stored to struct
ath12k_hw.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Link: https://patch.msgid.link/20241101151705.165987-5-kvalo@kernel.org
Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>
drivers/net/wireless/ath/ath12k/core.h
drivers/net/wireless/ath/ath12k/debug.c
drivers/net/wireless/ath/ath12k/debug.h
drivers/net/wireless/ath/ath12k/mac.c

index 23e27d11985955e55535f3c7c45e8c69a5edb2ec..e084e231f753c45813c3de921c13420057b13dc1 100644 (file)
@@ -691,6 +691,8 @@ struct ath12k {
 
 struct ath12k_hw {
        struct ieee80211_hw *hw;
+       struct device *dev;
+
        /* Protect the write operation of the hardware state ath12k_hw::state
         * between hardware start<=>reconfigure<=>stop transitions.
         */
index fe5a732ba9ec94fc0350e3c471d1315b8216abf3..ff6eaeafa092cd12e572430ed0f1c7aa21b78377 100644 (file)
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: BSD-3-Clause-Clear
 /*
  * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #include <linux/vmalloc.h>
@@ -36,7 +36,7 @@ void ath12k_err(struct ath12k_base *ab, const char *fmt, ...)
        va_end(args);
 }
 
-void ath12k_warn(struct ath12k_base *ab, const char *fmt, ...)
+void __ath12k_warn(struct device *dev, const char *fmt, ...)
 {
        struct va_format vaf = {
                .fmt = fmt,
@@ -45,7 +45,7 @@ void ath12k_warn(struct ath12k_base *ab, const char *fmt, ...)
 
        va_start(args, fmt);
        vaf.va = &args;
-       dev_warn_ratelimited(ab->dev, "%pV", &vaf);
+       dev_warn_ratelimited(dev, "%pV", &vaf);
        /* TODO: Trace the log */
        va_end(args);
 }
index f7005917362c62940260195beefbadcbf2e50056..90e801136bc65006786bf0a5d7b7319d2aa55c9b 100644 (file)
@@ -31,7 +31,10 @@ enum ath12k_debug_mask {
 
 __printf(2, 3) void ath12k_info(struct ath12k_base *ab, const char *fmt, ...);
 __printf(2, 3) void ath12k_err(struct ath12k_base *ab, const char *fmt, ...);
-__printf(2, 3) void ath12k_warn(struct ath12k_base *ab, const char *fmt, ...);
+__printf(2, 3) void __ath12k_warn(struct device *dev, const char *fmt, ...);
+
+#define ath12k_warn(ab, fmt, ...) __ath12k_warn((ab)->dev, fmt, ##__VA_ARGS__)
+#define ath12k_hw_warn(ah, fmt, ...) __ath12k_warn((ah)->dev, fmt, ##__VA_ARGS__)
 
 extern unsigned int ath12k_debug_mask;
 
index 73a80b55b229f6b3d1a222690e203f2a7106f927..5b8d4aa0eefdc0838731f79fa765e3a018f505af 100644 (file)
@@ -10179,6 +10179,8 @@ int ath12k_mac_allocate(struct ath12k_base *ab)
                        goto err;
                }
 
+               ah->dev = ab->dev;
+
                ab->ah[i] = ah;
        }