diff mbox series

[v2] wifi: brcmsmac: simplify wlc_phy_rxcal_radio_setup_nphy()

Message ID 20241030113417.375847-1-dmantipov@yandex.ru
State New
Headers show
Series [v2] wifi: brcmsmac: simplify wlc_phy_rxcal_radio_setup_nphy() | expand

Commit Message

Dmitry Antipov Oct. 30, 2024, 11:34 a.m. UTC
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.

Reported-by: Colin King <colin.i.king@gmail.com>
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
---
v2: add Reported-by: as suggested by Arend
---
 .../broadcom/brcm80211/brcmsmac/phy/phy_n.c   | 44 ++-----------------
 1 file changed, 4 insertions(+), 40 deletions(-)
diff mbox series

Patch

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,