wifi: rtlwifi: rtl8192ce: using calculate_bit_shift()

[ Upstream commit 3d03e8231031bcc65a48cd88ef9c71b6524ce70b ]

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

Fixes: 0c8173385e ("rtl8192ce: Add new driver")
Signed-off-by: Su Hui <suhui@nfschina.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20231219065739.1895666-7-suhui@nfschina.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Su Hui 2023-12-19 14:57:34 +08:00 committed by Greg Kroah-Hartman
parent a3a25b5d01
commit ae1df4cc0a
2 changed files with 3 additions and 4 deletions

View File

@ -39,7 +39,7 @@ u32 rtl92c_phy_query_rf_reg(struct ieee80211_hw *hw,
rfpath, regaddr); rfpath, regaddr);
} }
bitshift = _rtl92c_phy_calculate_bit_shift(bitmask); bitshift = calculate_bit_shift(bitmask);
readback_value = (original_value & bitmask) >> bitshift; readback_value = (original_value & bitmask) >> bitshift;
spin_unlock(&rtlpriv->locks.rf_lock); spin_unlock(&rtlpriv->locks.rf_lock);
@ -110,7 +110,7 @@ void rtl92ce_phy_set_rf_reg(struct ieee80211_hw *hw,
original_value = _rtl92c_phy_rf_serial_read(hw, original_value = _rtl92c_phy_rf_serial_read(hw,
rfpath, rfpath,
regaddr); regaddr);
bitshift = _rtl92c_phy_calculate_bit_shift(bitmask); bitshift = calculate_bit_shift(bitmask);
data = data =
((original_value & (~bitmask)) | ((original_value & (~bitmask)) |
(data << bitshift)); (data << bitshift));
@ -122,7 +122,7 @@ void rtl92ce_phy_set_rf_reg(struct ieee80211_hw *hw,
original_value = _rtl92c_phy_fw_rf_serial_read(hw, original_value = _rtl92c_phy_fw_rf_serial_read(hw,
rfpath, rfpath,
regaddr); regaddr);
bitshift = _rtl92c_phy_calculate_bit_shift(bitmask); bitshift = calculate_bit_shift(bitmask);
data = data =
((original_value & (~bitmask)) | ((original_value & (~bitmask)) |
(data << bitshift)); (data << bitshift));

View File

@ -94,7 +94,6 @@ u32 _rtl92c_phy_rf_serial_read(struct ieee80211_hw *hw, enum radio_path rfpath,
u32 offset); u32 offset);
u32 _rtl92c_phy_fw_rf_serial_read(struct ieee80211_hw *hw, u32 _rtl92c_phy_fw_rf_serial_read(struct ieee80211_hw *hw,
enum radio_path rfpath, u32 offset); enum radio_path rfpath, u32 offset);
u32 _rtl92c_phy_calculate_bit_shift(u32 bitmask);
void _rtl92c_phy_rf_serial_write(struct ieee80211_hw *hw, void _rtl92c_phy_rf_serial_write(struct ieee80211_hw *hw,
enum radio_path rfpath, u32 offset, u32 data); enum radio_path rfpath, u32 offset, u32 data);
void _rtl92c_phy_fw_rf_serial_write(struct ieee80211_hw *hw, void _rtl92c_phy_fw_rf_serial_write(struct ieee80211_hw *hw,