Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6100707rdb; Thu, 14 Dec 2023 08:17:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IE4WA27RRmlYFGwK/dlmwtEQBw2Ebod/HYUh/WAakDYJRhVAIWoaJa1dMHHk2bvkVHxXTtx X-Received: by 2002:a17:903:2351:b0:1d0:6ffd:cea1 with SMTP id c17-20020a170903235100b001d06ffdcea1mr6296358plh.90.1702570672245; Thu, 14 Dec 2023 08:17:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702570672; cv=none; d=google.com; s=arc-20160816; b=we8awbVl1iJF198uYiJo/r1/usOGEoCnZ1yVl/82+GAOLINfg9KIT6b9b4Sqe2oFaF iw+3EPuV54iy2Nn5yG5wy7FDuhKJGNAiILL6yfXEM4FvbcgoqfdWSlNcoz56yUbYk8NI j/Fm0l260WbLWf//ff6b/os6g6b7250g7wZh3pe5m2jf1O9r39sxTaUeDqWa9E5P7soj kJslaXTpYZBP0/2EM30WhU4OEvaQgpnH2aT9CJd2xMzakkgk+8ViERK15P3CvgsDg+c4 CpVnB0YmQTSeiMLqHt8bW1XdLZzuLY72HU3i24S9L8EmwyvCNeYuMb/ZFAk+/syQEeq8 ufNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=hz1+YMRAstdv5EgbChlbxOov2x2Um/C96q0K55+WKRg=; fh=hQUEiiksHvYN/EFmEKRXMJqwCC0zT2cV3viCNHAv7Ok=; b=Wde7QOPVUx5aET+EX+mdVIYCejmEvWva6BZvwAzLlFVfQPPjl2gn6UczxceOJmATiK maknbmJNHwhaM6+Qv/TV95Sr7THYRB7iRnG12SJonhLk7DNajh2Is5Wts7vFWYY/7qzJ F8LivL2ouaa0Hu81jtBy9mdZWwMbMErGeNaJ3wklhVmGzxm56+NHRIV2qUQ8/2MhotJi iiR8IKA62/PRXAp5jvIu5CrFNVcvP7A/kb7r4ZicV31iGXLisVmGGUcxbFtZpZ5/A4+g ImCab66E/u0V8Un++JeYj4ScH0U8YoYvyrCeGcqnxAu0c739HcnKCRv7Pl+D7Fia/WzJ sNbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LV6roAwc; spf=pass (google.com: domain of linux-wireless+bounces-804-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-wireless+bounces-804-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id c6-20020a170902848600b001d0050e2452si1124456plo.45.2023.12.14.08.17.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 08:17:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-804-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LV6roAwc; spf=pass (google.com: domain of linux-wireless+bounces-804-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-wireless+bounces-804-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 26366B20B0B for ; Thu, 14 Dec 2023 16:17:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2CF545F1C1; Thu, 14 Dec 2023 16:17:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LV6roAwc" X-Original-To: linux-wireless@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 11F475EE94 for ; Thu, 14 Dec 2023 16:17:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3A57C433C8; Thu, 14 Dec 2023 16:17:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702570664; bh=HK2BDsbsHED2loV2Pn+V2u8GAyC11wNlFeiJkuRxH6U=; h=From:To:Cc:Subject:Date:From; b=LV6roAwc0lWjnq+YxsLp4q3/4VyNnCZ13UP7MKvqXOm//3zZvGKp4MnRCLuNdCwfS UiLWF61E7BN2KwkduWgwY040wbmcULQawvK0bLsQmHX9392QFOtzbS7gvR8cews22G almDKa1VZW7Agkt0KXhlkETgfVvyRsa5k7L29vSLSjJWXvUHn3khz4Rrpt3vwnIYrk bNx79nVbr0V73gku6wv06RoQ5nCQPxQ3IfgExtui/zlaumIYdeVTScY8JtRzJ4CPV6 Q8ksQlgLPY0cGBgH4LEhrvixwOJpeptUocu+8Gd1yaEjpUt2/wBLYvUlpAlzjIGueq uOKv9htCb36Fg== From: Kalle Valo To: ath11k@lists.infradead.org Cc: linux-wireless@vger.kernel.org Subject: [PATCH] wifi: ath11k: workaround too long expansion sparse warnings Date: Thu, 14 Dec 2023 18:17:40 +0200 Message-Id: <20231214161740.1582340-1-kvalo@kernel.org> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Kalle Valo 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 --- 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