linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] wifi: ath11k: workaround too long expansion sparse warnings
@ 2023-12-14 16:17 Kalle Valo
  2023-12-14 16:53 ` Jeff Johnson
  2023-12-15 15:59 ` Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Kalle Valo @ 2023-12-14 16:17 UTC (permalink / raw)
  To: ath11k; +Cc: linux-wireless

From: Kalle Valo <quic_kvalo@quicinc.com>

In v6.7-rc1 sparse warns:

drivers/net/wireless/ath/ath11k/mac.c:4702:15: error: too long token expansion
drivers/net/wireless/ath/ath11k/mac.c:4702:15: error: too long token expansion
drivers/net/wireless/ath/ath11k/mac.c:8393:23: error: too long token expansion
drivers/net/wireless/ath/ath11k/mac.c:8393:23: error: too long token expansion

Workaround the warnings by refactoring the code to a new function, which also
reduces code duplication. And in the new function use max3() to make the code
more readable.

No functional changes, compile tested only.

Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
---
 drivers/net/wireless/ath/ath11k/mac.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index 7f7b39817773..db241589424d 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -4654,6 +4654,14 @@ static int ath11k_station_disassoc(struct ath11k *ar,
 	return 0;
 }
 
+static u32 ath11k_mac_max_nss(const u8 *ht_mcs_mask, const u16 *vht_mcs_mask,
+			      const u16 *he_mcs_mask)
+{
+	return max3(ath11k_mac_max_ht_nss(ht_mcs_mask),
+		    ath11k_mac_max_vht_nss(vht_mcs_mask),
+		    ath11k_mac_max_he_nss(he_mcs_mask));
+}
+
 static void ath11k_sta_rc_update_wk(struct work_struct *wk)
 {
 	struct ath11k *ar;
@@ -4699,9 +4707,7 @@ static void ath11k_sta_rc_update_wk(struct work_struct *wk)
 	mutex_lock(&ar->conf_mutex);
 
 	nss = max_t(u32, 1, nss);
-	nss = min(nss, max(max(ath11k_mac_max_ht_nss(ht_mcs_mask),
-			       ath11k_mac_max_vht_nss(vht_mcs_mask)),
-			   ath11k_mac_max_he_nss(he_mcs_mask)));
+	nss = min(nss, ath11k_mac_max_nss(ht_mcs_mask, vht_mcs_mask, he_mcs_mask));
 
 	if (changed & IEEE80211_RC_BW_CHANGED) {
 		/* Get the peer phymode */
@@ -8391,9 +8397,7 @@ ath11k_mac_op_set_bitrate_mask(struct ieee80211_hw *hw,
 			ath11k_warn(ar->ab,
 				    "could not update fixed rate settings to all peers due to mcs/nss incompatibility\n");
 		nss = min_t(u32, ar->num_tx_chains,
-			    max(max(ath11k_mac_max_ht_nss(ht_mcs_mask),
-				    ath11k_mac_max_vht_nss(vht_mcs_mask)),
-				ath11k_mac_max_he_nss(he_mcs_mask)));
+			    ath11k_mac_max_nss(ht_mcs_mask, vht_mcs_mask, he_mcs_mask));
 
 		/* If multiple rates across different preambles are given
 		 * we can reconfigure this info with all peers using PEER_ASSOC

base-commit: e0d94824fa388d81bb1f27e9486cb2d0f6fee3fb
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] wifi: ath11k: workaround too long expansion sparse warnings
  2023-12-14 16:17 [PATCH] wifi: ath11k: workaround too long expansion sparse warnings Kalle Valo
@ 2023-12-14 16:53 ` Jeff Johnson
  2023-12-15 15:59 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Johnson @ 2023-12-14 16:53 UTC (permalink / raw)
  To: Kalle Valo, ath11k; +Cc: linux-wireless

On 12/14/2023 8:17 AM, Kalle Valo wrote:
> From: Kalle Valo <quic_kvalo@quicinc.com>
> 
> In v6.7-rc1 sparse warns:
> 
> drivers/net/wireless/ath/ath11k/mac.c:4702:15: error: too long token expansion
> drivers/net/wireless/ath/ath11k/mac.c:4702:15: error: too long token expansion
> drivers/net/wireless/ath/ath11k/mac.c:8393:23: error: too long token expansion
> drivers/net/wireless/ath/ath11k/mac.c:8393:23: error: too long token expansion
> 
> Workaround the warnings by refactoring the code to a new function, which also
> reduces code duplication. And in the new function use max3() to make the code
> more readable.
> 
> No functional changes, compile tested only.
> 
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] wifi: ath11k: workaround too long expansion sparse warnings
  2023-12-14 16:17 [PATCH] wifi: ath11k: workaround too long expansion sparse warnings Kalle Valo
  2023-12-14 16:53 ` Jeff Johnson
@ 2023-12-15 15:59 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2023-12-15 15:59 UTC (permalink / raw)
  To: Kalle Valo; +Cc: ath11k, linux-wireless

Kalle Valo <kvalo@kernel.org> wrote:

> In v6.7-rc1 sparse warns:
> 
> drivers/net/wireless/ath/ath11k/mac.c:4702:15: error: too long token expansion
> drivers/net/wireless/ath/ath11k/mac.c:4702:15: error: too long token expansion
> drivers/net/wireless/ath/ath11k/mac.c:8393:23: error: too long token expansion
> drivers/net/wireless/ath/ath11k/mac.c:8393:23: error: too long token expansion
> 
> Workaround the warnings by refactoring the code to a new function, which also
> reduces code duplication. And in the new function use max3() to make the code
> more readable.
> 
> No functional changes, compile tested only.
> 
> Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>

Patch applied to ath-next branch of ath.git, thanks.

fd6ed1772b2c wifi: ath11k: workaround too long expansion sparse warnings

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20231214161740.1582340-1-kvalo@kernel.org/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-12-15 15:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-14 16:17 [PATCH] wifi: ath11k: workaround too long expansion sparse warnings Kalle Valo
2023-12-14 16:53 ` Jeff Johnson
2023-12-15 15:59 ` Kalle Valo

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).