From patchwork Tue Oct 29 11:49:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Antipov X-Patchwork-Id: 13854787 X-Patchwork-Delegate: kvalo@adurom.com Received: from forward206a.mail.yandex.net (forward206a.mail.yandex.net [178.154.239.87]) (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 EC7DE205AD9 for ; Tue, 29 Oct 2024 11:55:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.154.239.87 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730202963; cv=none; b=NYRpEcQE6My3W2bNS5FbncrHZ61tR9M+pHLi+c2BATHx79oczYFK1poDwI06c8ajOE40BuSMAjCWTaAG9H93jjaX9O2I+AE1Zt+TLPPgBBVH2q7FzAqAxby7MEMDb44X8/MHW8WfpK4PBUNAqFrg/TwAOOEbGRdzuAV+nqVTn4o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730202963; c=relaxed/simple; bh=tM4zTcYylN22EeDy6q+ZcO+lrYdW42sEhSCB3DWYfY8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=dSmEaXaaCWayBSvBWEX7FMgpTjSEYgh29tq5sht/KJlFjxryOKepIM6l+M5crJqNxWTsdOz+fMDnT0Rui60jcUMo8PwBZByLPOMeH5wXy9K2OfJVEQ5QBSzJKTZgFpHHSWEdKccbORkEYFaM9KHlh3k25yMgKlGLH5HsECF4QLg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=yandex.ru; spf=pass smtp.mailfrom=yandex.ru; dkim=pass (1024-bit key) header.d=yandex.ru header.i=@yandex.ru header.b=A69ElzQa; arc=none smtp.client-ip=178.154.239.87 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=yandex.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=yandex.ru Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=yandex.ru header.i=@yandex.ru header.b="A69ElzQa" Received: from forward103a.mail.yandex.net (forward103a.mail.yandex.net [IPv6:2a02:6b8:c0e:500:1:45:d181:d103]) by forward206a.mail.yandex.net (Yandex) with ESMTPS id 3EC2C699E9 for ; Tue, 29 Oct 2024 14:49:47 +0300 (MSK) Received: from mail-nwsmtp-smtp-production-main-73.iva.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-73.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:c110:0:640:2b5b:0]) by forward103a.mail.yandex.net (Yandex) with ESMTPS id BE98E60E2D; Tue, 29 Oct 2024 14:49:38 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-73.iva.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id bnXHPp9XlGk0-aIYiTiJz; Tue, 29 Oct 2024 14:49:38 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1730202578; bh=EGoRCJpDANAblBKUial/HJdHUrC3OLZ0+gCYr5JqCpw=; h=Message-ID:Date:Cc:Subject:To:From; b=A69ElzQapZETwFGFeG+EYEf87vpYlGW+TDYBIkdO5zKMi3LZE0gFh3X1y3qBQYHIA o0Bob51V3pfwrtXdOQR9ja9HNMmz44cSpTf9FL7WL0SI2Lxz3+QGKAOv6O77xVIERf 5TbTXpUuUrCcy9mQjlZOn7H4qUVHGgJDDZzwkIrE= Authentication-Results: mail-nwsmtp-smtp-production-main-73.iva.yp-c.yandex.net; dkim=pass header.i=@yandex.ru From: Dmitry Antipov To: Arend van Spriel Cc: Kalle Valo , linux-wireless@vger.kernel.org, lvc-project@linuxtesting.org, Dmitry Antipov Subject: [PATCH] wifi: brcmsmac: simplify wlc_phy_rxcal_radio_setup_nphy() Date: Tue, 29 Oct 2024 14:49:12 +0300 Message-ID: <20241029114912.1534179-1-dmantipov@yandex.ru> X-Mailer: git-send-email 2.47.0 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Since 'tx_rx_cal_radio_saveregs[]' of 'struct brcms_phy' is 'u16', 'pi->tx_rx_cal_radio_saveregs[2] & 0xF0) >> 8' is always zero, so a few duplicated snippets in 'wlc_phy_rxcal_radio_setup_nphy()' may be reduced to compile-time constant (in fact, the same thing is actually done by both gcc and clang I've tried). Compile tested only. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Dmitry Antipov --- .../broadcom/brcm80211/brcmsmac/phy/phy_n.c | 44 ++----------------- 1 file changed, 4 insertions(+), 40 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c index d69879e1bd87..48343c820422 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c @@ -26201,7 +26201,6 @@ static void wlc_phy_calc_rx_iq_comp_nphy(struct brcms_phy *pi, u8 core_mask) static void wlc_phy_rxcal_radio_setup_nphy(struct brcms_phy *pi, u8 rx_core) { - u16 offtune_val; u16 bias_g = 0; u16 bias_a = 0; @@ -26322,17 +26321,9 @@ static void wlc_phy_rxcal_radio_setup_nphy(struct brcms_phy *pi, u8 rx_core) read_radio_reg(pi, RADIO_2056_RX_LNAA_TUNE | RADIO_2056_RX0); - - offtune_val = - (pi->tx_rx_cal_radio_saveregs - [2] & 0xF0) >> 8; - offtune_val = - (offtune_val <= 0x7) ? 0xF : 0; - mod_radio_reg(pi, RADIO_2056_RX_LNAA_TUNE | - RADIO_2056_RX0, 0xF0, - (offtune_val << 8)); + RADIO_2056_RX0, 0xF0, 0xF00); } write_radio_reg(pi, @@ -26372,18 +26363,9 @@ static void wlc_phy_rxcal_radio_setup_nphy(struct brcms_phy *pi, u8 rx_core) pi, RADIO_2056_RX_LNAG_TUNE | RADIO_2056_RX0); - - offtune_val = - (pi-> - tx_rx_cal_radio_saveregs[2] & - 0xF0) >> 8; - offtune_val = - (offtune_val <= 0x7) ? 0xF : 0; - mod_radio_reg(pi, RADIO_2056_RX_LNAG_TUNE | - RADIO_2056_RX0, 0xF0, - (offtune_val << 8)); + RADIO_2056_RX0, 0xF0, 0xF00); } write_radio_reg(pi, @@ -26446,18 +26428,9 @@ static void wlc_phy_rxcal_radio_setup_nphy(struct brcms_phy *pi, u8 rx_core) pi, RADIO_2056_RX_LNAA_TUNE | RADIO_2056_RX1); - - offtune_val = - (pi-> - tx_rx_cal_radio_saveregs[2] & - 0xF0) >> 8; - offtune_val = - (offtune_val <= 0x7) ? 0xF : 0; - mod_radio_reg(pi, RADIO_2056_RX_LNAA_TUNE | - RADIO_2056_RX1, 0xF0, - (offtune_val << 8)); + RADIO_2056_RX1, 0xF0, 0xF00); } write_radio_reg(pi, @@ -26496,18 +26469,9 @@ static void wlc_phy_rxcal_radio_setup_nphy(struct brcms_phy *pi, u8 rx_core) pi, RADIO_2056_RX_LNAG_TUNE | RADIO_2056_RX1); - - offtune_val = - (pi-> - tx_rx_cal_radio_saveregs[2] & - 0xF0) >> 8; - offtune_val = - (offtune_val <= 0x7) ? 0xF : 0; - mod_radio_reg(pi, RADIO_2056_RX_LNAG_TUNE | - RADIO_2056_RX1, 0xF0, - (offtune_val << 8)); + RADIO_2056_RX1, 0xF0, 0xF00); } write_radio_reg(pi,