Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 18c2989c authored by Su Hui's avatar Su Hui Committed by Greg Kroah-Hartman
Browse files

wifi: rtlwifi: rtl8723{be,ae}: using calculate_bit_shift()



[ Upstream commit 5c16618bc06a41ad68fd8499a21d35ef57ca06c2 ]

Using calculate_bit_shift() to replace rtl8723_phy_calculate_bit_shift().
And fix an undefined bitwise shift behavior problem.

Signed-off-by: default avatarSu Hui <suhui@nfschina.com>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20231219065739.1895666-12-suhui@nfschina.com


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 8ec36f2d
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ u32 rtl8723e_phy_query_rf_reg(struct ieee80211_hw *hw,
							    rfpath, regaddr);
	}

	bitshift = rtl8723_phy_calculate_bit_shift(bitmask);
	bitshift = calculate_bit_shift(bitmask);
	readback_value = (original_value & bitmask) >> bitshift;

	spin_unlock_irqrestore(&rtlpriv->locks.rf_lock, flags);
@@ -82,7 +82,7 @@ void rtl8723e_phy_set_rf_reg(struct ieee80211_hw *hw,
			original_value = rtl8723_phy_rf_serial_read(hw,
								    rfpath,
								    regaddr);
			bitshift = rtl8723_phy_calculate_bit_shift(bitmask);
			bitshift = calculate_bit_shift(bitmask);
			data =
			    ((original_value & (~bitmask)) |
			     (data << bitshift));
@@ -91,7 +91,7 @@ void rtl8723e_phy_set_rf_reg(struct ieee80211_hw *hw,
		rtl8723_phy_rf_serial_write(hw, rfpath, regaddr, data);
	} else {
		if (bitmask != RFREG_OFFSET_MASK) {
			bitshift = rtl8723_phy_calculate_bit_shift(bitmask);
			bitshift = calculate_bit_shift(bitmask);
			data =
			    ((original_value & (~bitmask)) |
			     (data << bitshift));
+2 −2
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ u32 rtl8723be_phy_query_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath,
	spin_lock_irqsave(&rtlpriv->locks.rf_lock, flags);

	original_value = rtl8723_phy_rf_serial_read(hw, rfpath, regaddr);
	bitshift = rtl8723_phy_calculate_bit_shift(bitmask);
	bitshift = calculate_bit_shift(bitmask);
	readback_value = (original_value & bitmask) >> bitshift;

	spin_unlock_irqrestore(&rtlpriv->locks.rf_lock, flags);
@@ -70,7 +70,7 @@ void rtl8723be_phy_set_rf_reg(struct ieee80211_hw *hw, enum radio_path path,
	if (bitmask != RFREG_OFFSET_MASK) {
			original_value = rtl8723_phy_rf_serial_read(hw, path,
								    regaddr);
			bitshift = rtl8723_phy_calculate_bit_shift(bitmask);
			bitshift = calculate_bit_shift(bitmask);
			data = ((original_value & (~bitmask)) |
				(data << bitshift));
		}