From: Aditya Kumar Singh <aditya.kumar.singh@oss.qualcomm.com>
To: Jeff Johnson <jjohnson@kernel.org>
Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org,
linux-kernel@vger.kernel.org,
Aditya Kumar Singh <aditya.kumar.singh@oss.qualcomm.com>
Subject: [PATCH ath-next 2/4] wifi: ath11k: wrap ath11k_mac_op_get_txpower() with lock-aware internal helper
Date: Fri, 17 Oct 2025 09:37:58 +0530 [thread overview]
Message-ID: <20251017-add_tx_power_insertion_support-v1-2-f08feacfca93@oss.qualcomm.com> (raw)
In-Reply-To: <20251017-add_tx_power_insertion_support-v1-0-f08feacfca93@oss.qualcomm.com>
Refactor ath11k_mac_op_get_txpower() by introducing a new internal function
ath11k_mac_handle_get_txpower(), which assumes the caller holds the
appropriate lock. This prepares the codebase for future change where the
internal function may be invoked directly with the lock already acquired,
improving modularity and lock handling consistency.
No functional change intended.
Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1
Signed-off-by: Aditya Kumar Singh <aditya.kumar.singh@oss.qualcomm.com>
---
drivers/net/wireless/ath/ath11k/mac.c | 31 ++++++++++++++++++++-----------
1 file changed, 20 insertions(+), 11 deletions(-)
diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index a7bd0ddf5fdf..cd6e98ee1232 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -4103,12 +4103,10 @@ static int ath11k_mac_get_fw_stats(struct ath11k *ar, u32 pdev_id,
return ret;
}
-static int ath11k_mac_op_get_txpower(struct ieee80211_hw *hw,
- struct ieee80211_vif *vif,
- unsigned int link_id,
- int *dbm)
+static int ath11k_mac_handle_get_txpower(struct ath11k *ar,
+ struct ieee80211_vif *vif,
+ int *dbm)
{
- struct ath11k *ar = hw->priv;
struct ath11k_base *ab = ar->ab;
struct ath11k_fw_stats_pdev *pdev;
int ret;
@@ -4119,15 +4117,13 @@ static int ath11k_mac_op_get_txpower(struct ieee80211_hw *hw,
* of these. Hence, we request the FW pdev stats in which FW reports
* the minimum of all vdev's channel Tx power.
*/
- mutex_lock(&ar->conf_mutex);
+ lockdep_assert_held(&ar->conf_mutex);
/* Firmware doesn't provide Tx power during CAC hence no need to fetch
* the stats.
*/
- if (test_bit(ATH11K_CAC_RUNNING, &ar->dev_flags)) {
- mutex_unlock(&ar->conf_mutex);
+ if (test_bit(ATH11K_CAC_RUNNING, &ar->dev_flags))
return -EAGAIN;
- }
ret = ath11k_mac_get_fw_stats(ar, ar->pdev->pdev_id, 0,
WMI_REQUEST_PDEV_STAT);
@@ -4148,14 +4144,12 @@ static int ath11k_mac_op_get_txpower(struct ieee80211_hw *hw,
*dbm = pdev->chan_tx_power / 2;
spin_unlock_bh(&ar->data_lock);
- mutex_unlock(&ar->conf_mutex);
ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "txpower from firmware %d, reported %d dBm\n",
pdev->chan_tx_power, *dbm);
return 0;
err_fallback:
- mutex_unlock(&ar->conf_mutex);
/* We didn't get txpower from FW. Hence, relying on vif->bss_conf.txpower */
*dbm = vif->bss_conf.txpower;
ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "txpower from firmware NaN, reported %d dBm\n",
@@ -4163,6 +4157,21 @@ static int ath11k_mac_op_get_txpower(struct ieee80211_hw *hw,
return 0;
}
+static int ath11k_mac_op_get_txpower(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif,
+ unsigned int link_id,
+ int *dbm)
+{
+ struct ath11k *ar = hw->priv;
+ int ret;
+
+ mutex_lock(&ar->conf_mutex);
+ ret = ath11k_mac_handle_get_txpower(ar, vif, dbm);
+ mutex_unlock(&ar->conf_mutex);
+
+ return ret;
+}
+
static int ath11k_mac_op_hw_scan(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct ieee80211_scan_request *hw_req)
--
2.34.1
next prev parent reply other threads:[~2025-10-17 4:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-17 4:07 [PATCH ath-next 0/4] wifi: ath11k: add support for Tx Power insertion Aditya Kumar Singh
2025-10-17 4:07 ` [PATCH ath-next 1/4] wifi: ath11k: relocate some Tx power related functions in mac.c Aditya Kumar Singh
2025-10-17 4:07 ` Aditya Kumar Singh [this message]
2025-10-17 4:07 ` [PATCH ath-next 3/4] wifi: ath11k: add support for Tx Power insertion in RRM action frame Aditya Kumar Singh
2025-10-17 4:08 ` [PATCH ath-next 4/4] wifi: ath11k: advertise NL80211_FEATURE_TX_POWER_INSERTION Aditya Kumar Singh
2025-10-22 1:59 ` [PATCH ath-next 0/4] wifi: ath11k: add support for Tx Power insertion Baochen Qiang
2025-10-22 3:25 ` Vasanthakumar Thiagarajan
2025-10-23 14:03 ` Jeff Johnson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251017-add_tx_power_insertion_support-v1-2-f08feacfca93@oss.qualcomm.com \
--to=aditya.kumar.singh@oss.qualcomm.com \
--cc=ath11k@lists.infradead.org \
--cc=jjohnson@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).