wifi: rtlwifi: rtl8188ee: phy: using calculate_bit_shift()
Using calculate_bit_shift() to replace _rtl88e_phy_calculate_bit_shift(). And fix the undefined bitwise shift behavior problem. Fixes: f0eb856e0b6c ("rtlwifi: rtl8188ee: 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-4-suhui@nfschina.com
This commit is contained in:
parent
acefef7a7e
commit
969bc926f0
@ -16,12 +16,6 @@ static u32 _rtl88e_phy_rf_serial_read(struct ieee80211_hw *hw,
|
||||
static void _rtl88e_phy_rf_serial_write(struct ieee80211_hw *hw,
|
||||
enum radio_path rfpath, u32 offset,
|
||||
u32 data);
|
||||
static u32 _rtl88e_phy_calculate_bit_shift(u32 bitmask)
|
||||
{
|
||||
u32 i = ffs(bitmask);
|
||||
|
||||
return i ? i - 1 : 32;
|
||||
}
|
||||
static bool _rtl88e_phy_bb8188e_config_parafile(struct ieee80211_hw *hw);
|
||||
static bool _rtl88e_phy_config_mac_with_headerfile(struct ieee80211_hw *hw);
|
||||
static bool phy_config_bb_with_headerfile(struct ieee80211_hw *hw,
|
||||
@ -51,7 +45,7 @@ u32 rtl88e_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 = _rtl88e_phy_calculate_bit_shift(bitmask);
|
||||
bitshift = calculate_bit_shift(bitmask);
|
||||
returnvalue = (originalvalue & bitmask) >> bitshift;
|
||||
|
||||
rtl_dbg(rtlpriv, COMP_RF, DBG_TRACE,
|
||||
@ -74,7 +68,7 @@ void rtl88e_phy_set_bb_reg(struct ieee80211_hw *hw,
|
||||
|
||||
if (bitmask != MASKDWORD) {
|
||||
originalvalue = rtl_read_dword(rtlpriv, regaddr);
|
||||
bitshift = _rtl88e_phy_calculate_bit_shift(bitmask);
|
||||
bitshift = calculate_bit_shift(bitmask);
|
||||
data = ((originalvalue & (~bitmask)) | (data << bitshift));
|
||||
}
|
||||
|
||||
@ -99,7 +93,7 @@ u32 rtl88e_phy_query_rf_reg(struct ieee80211_hw *hw,
|
||||
|
||||
|
||||
original_value = _rtl88e_phy_rf_serial_read(hw, rfpath, regaddr);
|
||||
bitshift = _rtl88e_phy_calculate_bit_shift(bitmask);
|
||||
bitshift = calculate_bit_shift(bitmask);
|
||||
readback_value = (original_value & bitmask) >> bitshift;
|
||||
|
||||
spin_unlock(&rtlpriv->locks.rf_lock);
|
||||
@ -127,7 +121,7 @@ void rtl88e_phy_set_rf_reg(struct ieee80211_hw *hw,
|
||||
original_value = _rtl88e_phy_rf_serial_read(hw,
|
||||
rfpath,
|
||||
regaddr);
|
||||
bitshift = _rtl88e_phy_calculate_bit_shift(bitmask);
|
||||
bitshift = calculate_bit_shift(bitmask);
|
||||
data =
|
||||
((original_value & (~bitmask)) |
|
||||
(data << bitshift));
|
||||
|
Loading…
x
Reference in New Issue
Block a user