wifi: rtlwifi: rtl8192de: using calculate_bit_shift()
Using calculate_bit_shift() to replace _rtl92d_phy_calculate_bit_shift().
And fix the undefined bitwise shift behavior problem.
Fixes: 7274a8c229
("rtlwifi: rtl8192de: Merge phy routines")
Signed-off-by: Su Hui <suhui@nfschina.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20231219065739.1895666-8-suhui@nfschina.com
This commit is contained in:
parent
3d03e82310
commit
b8b2baad2e
@ -169,13 +169,6 @@ static const u8 channel_all[59] = {
|
||||
157, 159, 161, 163, 165
|
||||
};
|
||||
|
||||
static u32 _rtl92d_phy_calculate_bit_shift(u32 bitmask)
|
||||
{
|
||||
u32 i = ffs(bitmask);
|
||||
|
||||
return i ? i - 1 : 32;
|
||||
}
|
||||
|
||||
u32 rtl92d_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask)
|
||||
{
|
||||
struct rtl_priv *rtlpriv = rtl_priv(hw);
|
||||
@ -198,7 +191,7 @@ u32 rtl92d_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask)
|
||||
} else {
|
||||
originalvalue = rtl_read_dword(rtlpriv, regaddr);
|
||||
}
|
||||
bitshift = _rtl92d_phy_calculate_bit_shift(bitmask);
|
||||
bitshift = calculate_bit_shift(bitmask);
|
||||
returnvalue = (originalvalue & bitmask) >> bitshift;
|
||||
rtl_dbg(rtlpriv, COMP_RF, DBG_TRACE,
|
||||
"BBR MASK=0x%x Addr[0x%x]=0x%x\n",
|
||||
@ -230,7 +223,7 @@ void rtl92d_phy_set_bb_reg(struct ieee80211_hw *hw,
|
||||
dbi_direct);
|
||||
else
|
||||
originalvalue = rtl_read_dword(rtlpriv, regaddr);
|
||||
bitshift = _rtl92d_phy_calculate_bit_shift(bitmask);
|
||||
bitshift = calculate_bit_shift(bitmask);
|
||||
data = ((originalvalue & (~bitmask)) | (data << bitshift));
|
||||
}
|
||||
if (rtlhal->during_mac1init_radioa || rtlhal->during_mac0init_radiob)
|
||||
@ -317,7 +310,7 @@ u32 rtl92d_phy_query_rf_reg(struct ieee80211_hw *hw,
|
||||
regaddr, rfpath, bitmask);
|
||||
spin_lock(&rtlpriv->locks.rf_lock);
|
||||
original_value = _rtl92d_phy_rf_serial_read(hw, rfpath, regaddr);
|
||||
bitshift = _rtl92d_phy_calculate_bit_shift(bitmask);
|
||||
bitshift = calculate_bit_shift(bitmask);
|
||||
readback_value = (original_value & bitmask) >> bitshift;
|
||||
spin_unlock(&rtlpriv->locks.rf_lock);
|
||||
rtl_dbg(rtlpriv, COMP_RF, DBG_TRACE,
|
||||
@ -343,7 +336,7 @@ void rtl92d_phy_set_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath,
|
||||
if (bitmask != RFREG_OFFSET_MASK) {
|
||||
original_value = _rtl92d_phy_rf_serial_read(hw,
|
||||
rfpath, regaddr);
|
||||
bitshift = _rtl92d_phy_calculate_bit_shift(bitmask);
|
||||
bitshift = calculate_bit_shift(bitmask);
|
||||
data = ((original_value & (~bitmask)) |
|
||||
(data << bitshift));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user