wifi: brcmsmac: silence sparse warnings
authorJohannes Berg <johannes.berg@intel.com>
Fri, 23 Feb 2024 10:40:24 +0000 (11:40 +0100)
committerKalle Valo <kvalo@kernel.org>
Wed, 28 Feb 2024 11:37:22 +0000 (13:37 +0200)
sparse complains on this code about casts that lose bits
due to the usage of bitwise not, but really we do want
16 bits only, so clarify that by using masks.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240223114023.06e5ade90bcd.I41a0cbae1fa259cfbf5fa117ddfce908877475a2@changeid
drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c
drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c

index 7717eb85a1db6821d256de94ca0af58eee0e4113..aae2cf95fe9588ce2f1045798dac9c0d77684b60 100644 (file)
@@ -3299,7 +3299,7 @@ wlc_lcnphy_run_samples(struct brcms_phy *pi,
 
        if (iqcalmode) {
 
-               and_phy_reg(pi, 0x453, (u16) ~(0x1 << 15));
+               and_phy_reg(pi, 0x453, 0xffff & ~(0x1 << 15));
                or_phy_reg(pi, 0x453, (0x1 << 15));
        } else {
                write_phy_reg(pi, 0x63f, 1);
index cd9b502a6a9fc31b91d71144dc4e347cf40593f4..d69879e1bd870c91008d56b255e041c62a7f20e3 100644 (file)
@@ -17582,7 +17582,7 @@ static void wlc_phy_txpwrctrl_pwr_setup_nphy(struct brcms_phy *pi)
        or_phy_reg(pi, 0x122, (0x1 << 0));
 
        if (NREV_GE(pi->pubpi.phy_rev, 3))
-               and_phy_reg(pi, 0x1e7, (u16) (~(0x1 << 15)));
+               and_phy_reg(pi, 0x1e7, 0x7fff);
        else
                or_phy_reg(pi, 0x1e7, (0x1 << 15));
 
@@ -18081,7 +18081,7 @@ wlc_phy_rfctrlintc_override_nphy(struct brcms_phy *pi, u8 field, u16 value,
                                                   (0x1 << 10));
 
                                        and_phy_reg(pi, 0x2ff, (u16)
-                                                   ~(0x3 << 14));
+                                                   0xffff & ~(0x3 << 14));
                                        or_phy_reg(pi, 0x2ff, (0x1 << 13));
                                        or_phy_reg(pi, 0x2ff, (0x1 << 0));
                                } else {
@@ -21048,7 +21048,7 @@ wlc_phy_chanspec_nphy_setup(struct brcms_phy *pi, u16 chanspec,
                      (val | MAC_PHY_FORCE_CLK));
 
                and_phy_reg(pi, (NPHY_TO_BPHY_OFF + BPHY_BB_CONFIG),
-                           (u16) (~(BBCFG_RESETCCA | BBCFG_RESETRX)));
+                           0xffff & ~(BBCFG_RESETCCA | BBCFG_RESETRX));
 
                bcma_write16(pi->d11core, D11REGOFFS(psm_phy_hdr_param), val);
        }
@@ -21282,7 +21282,8 @@ void wlc_phy_antsel_init(struct brcms_phy_pub *ppi, bool lut_init)
 
                bcma_set16(pi->d11core, D11REGOFFS(psm_gpio_oe), mask);
 
-               bcma_mask16(pi->d11core, D11REGOFFS(psm_gpio_out), ~mask);
+               bcma_mask16(pi->d11core, D11REGOFFS(psm_gpio_out),
+                           0xffff & ~mask);
 
                if (lut_init) {
                        write_phy_reg(pi, 0xf8, 0x02d8);
@@ -23192,7 +23193,7 @@ void wlc_phy_stopplayback_nphy(struct brcms_phy *pi)
                or_phy_reg(pi, 0xc3, NPHY_sampleCmd_STOP);
        else if (playback_status & 0x2)
                and_phy_reg(pi, 0xc2,
-                           (u16) ~NPHY_iqloCalCmdGctl_IQLO_CAL_EN);
+                           0xffff & ~NPHY_iqloCalCmdGctl_IQLO_CAL_EN);
 
        and_phy_reg(pi, 0xc3, (u16) ~(0x1 << 2));
 
@@ -28197,8 +28198,9 @@ void wlc_phy_txpwrctrl_enable_nphy(struct brcms_phy *pi, u8 ctrl_type)
 
                if (NREV_GE(pi->pubpi.phy_rev, 3))
                        and_phy_reg(pi, 0x1e7,
-                                   (u16) (~((0x1 << 15) |
-                                            (0x1 << 14) | (0x1 << 13))));
+                                   0xffff & ~((0x1 << 15) |
+                                              (0x1 << 14) |
+                                              (0x1 << 13)));
                else
                        and_phy_reg(pi, 0x1e7,
                                    (u16) (~((0x1 << 14) | (0x1 << 13))));