wifi: rtlwifi: rtl8192c: using calculate_bit_shift()
authorSu Hui <suhui@nfschina.com>
Tue, 19 Dec 2023 06:57:32 +0000 (14:57 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Jan 2024 23:35:28 +0000 (15:35 -0800)
[ Upstream commit 1dedc3a6699d827d345019e921b8d8f37f694333 ]

Using calculate_bit_shift() to replace _rtl92c_phy_calculate_bit_shift().
And fix the undefined bitwise shift behavior problem.

Fixes: 4295cd254af3 ("rtlwifi: Move common parts of rtl8192ce/phy.c")
Signed-off-by: Su Hui <suhui@nfschina.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20231219065739.1895666-5-suhui@nfschina.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/realtek/rtlwifi/rtl8192c/phy_common.c
drivers/net/wireless/realtek/rtlwifi/rtl8192c/phy_common.h

index 3d29c8d..144ee78 100644 (file)
@@ -17,7 +17,7 @@ u32 rtl92c_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask)
        rtl_dbg(rtlpriv, COMP_RF, DBG_TRACE, "regaddr(%#x), bitmask(%#x)\n",
                regaddr, bitmask);
        originalvalue = rtl_read_dword(rtlpriv, regaddr);
-       bitshift = _rtl92c_phy_calculate_bit_shift(bitmask);
+       bitshift = calculate_bit_shift(bitmask);
        returnvalue = (originalvalue & bitmask) >> bitshift;
 
        rtl_dbg(rtlpriv, COMP_RF, DBG_TRACE,
@@ -40,7 +40,7 @@ void rtl92c_phy_set_bb_reg(struct ieee80211_hw *hw,
 
        if (bitmask != MASKDWORD) {
                originalvalue = rtl_read_dword(rtlpriv, regaddr);
-               bitshift = _rtl92c_phy_calculate_bit_shift(bitmask);
+               bitshift = calculate_bit_shift(bitmask);
                data = ((originalvalue & (~bitmask)) | (data << bitshift));
        }
 
@@ -143,14 +143,6 @@ void _rtl92c_phy_rf_serial_write(struct ieee80211_hw *hw,
 }
 EXPORT_SYMBOL(_rtl92c_phy_rf_serial_write);
 
-u32 _rtl92c_phy_calculate_bit_shift(u32 bitmask)
-{
-       u32 i = ffs(bitmask);
-
-       return i ? i - 1 : 32;
-}
-EXPORT_SYMBOL(_rtl92c_phy_calculate_bit_shift);
-
 static void _rtl92c_phy_bb_config_1t(struct ieee80211_hw *hw)
 {
        rtl_set_bbreg(hw, RFPGA0_TXINFO, 0x3, 0x2);
index 75afa62..e64d377 100644 (file)
@@ -196,7 +196,6 @@ bool rtl92c_phy_set_rf_power_state(struct ieee80211_hw *hw,
 void rtl92ce_phy_set_rf_on(struct ieee80211_hw *hw);
 void rtl92c_phy_set_io(struct ieee80211_hw *hw);
 void rtl92c_bb_block_on(struct ieee80211_hw *hw);
-u32 _rtl92c_phy_calculate_bit_shift(u32 bitmask);
 long _rtl92c_phy_txpwr_idx_to_dbm(struct ieee80211_hw *hw,
                                  enum wireless_mode wirelessmode,
                                  u8 txpwridx);