All of lore.kernel.org
 help / color / mirror / Atom feed
From: Su Hui <suhui@nfschina.com>
To: pkshih@realtek.com, kvalo@kernel.org
Cc: Su Hui <suhui@nfschina.com>,
	linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: [PATCH wireless-next 02/11] wifi: rtlwifi: rtl8821ae: phy: using calculate_bit_shift()
Date: Tue, 19 Dec 2023 14:57:30 +0800	[thread overview]
Message-ID: <20231219065739.1895666-3-suhui@nfschina.com> (raw)
In-Reply-To: <20231219065739.1895666-1-suhui@nfschina.com>

using calculate_bit_shift() to replace
_rtl8821ae_phy_calculate_bit_shift().

Signed-off-by: Su Hui <suhui@nfschina.com>
---
 .../net/wireless/realtek/rtlwifi/rtl8821ae/phy.c  | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
index 68c3fb0395ce..1be51ea3f3c8 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
@@ -27,13 +27,6 @@ static u32 _rtl8821ae_phy_rf_serial_read(struct ieee80211_hw *hw,
 static void _rtl8821ae_phy_rf_serial_write(struct ieee80211_hw *hw,
 					   enum radio_path rfpath, u32 offset,
 					   u32 data);
-static u32 _rtl8821ae_phy_calculate_bit_shift(u32 bitmask)
-{
-	if (WARN_ON_ONCE(!bitmask))
-		return 0;
-
-	return __ffs(bitmask);
-}
 static bool _rtl8821ae_phy_bb8821a_config_parafile(struct ieee80211_hw *hw);
 /*static bool _rtl8812ae_phy_config_mac_with_headerfile(struct ieee80211_hw *hw);*/
 static bool _rtl8821ae_phy_config_mac_with_headerfile(struct ieee80211_hw *hw);
@@ -106,7 +99,7 @@ u32 rtl8821ae_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr,
 		"regaddr(%#x), bitmask(%#x)\n",
 		regaddr, bitmask);
 	originalvalue = rtl_read_dword(rtlpriv, regaddr);
-	bitshift = _rtl8821ae_phy_calculate_bit_shift(bitmask);
+	bitshift = calculate_bit_shift(bitmask);
 	returnvalue = (originalvalue & bitmask) >> bitshift;
 
 	rtl_dbg(rtlpriv, COMP_RF, DBG_TRACE,
@@ -127,7 +120,7 @@ void rtl8821ae_phy_set_bb_reg(struct ieee80211_hw *hw,
 
 	if (bitmask != MASKDWORD) {
 		originalvalue = rtl_read_dword(rtlpriv, regaddr);
-		bitshift = _rtl8821ae_phy_calculate_bit_shift(bitmask);
+		bitshift = calculate_bit_shift(bitmask);
 		data = ((originalvalue & (~bitmask)) |
 			((data << bitshift) & bitmask));
 	}
@@ -153,7 +146,7 @@ u32 rtl8821ae_phy_query_rf_reg(struct ieee80211_hw *hw,
 	spin_lock(&rtlpriv->locks.rf_lock);
 
 	original_value = _rtl8821ae_phy_rf_serial_read(hw, rfpath, regaddr);
-	bitshift = _rtl8821ae_phy_calculate_bit_shift(bitmask);
+	bitshift = calculate_bit_shift(bitmask);
 	readback_value = (original_value & bitmask) >> bitshift;
 
 	spin_unlock(&rtlpriv->locks.rf_lock);
@@ -181,7 +174,7 @@ void rtl8821ae_phy_set_rf_reg(struct ieee80211_hw *hw,
 	if (bitmask != RFREG_OFFSET_MASK) {
 		original_value =
 		   _rtl8821ae_phy_rf_serial_read(hw, rfpath, regaddr);
-		bitshift = _rtl8821ae_phy_calculate_bit_shift(bitmask);
+		bitshift = calculate_bit_shift(bitmask);
 		data = ((original_value & (~bitmask)) | (data << bitshift));
 	}
 
-- 
2.30.2


  parent reply	other threads:[~2023-12-19  6:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-19  6:57 [PATCH wireless-next 00/11] using calculate_bit_shift() to fix undefined bitwise shift behavior Su Hui
2023-12-19  6:57 ` [PATCH wireless-next 01/11] wifi: rtlwifi: add calculate_bit_shift() Su Hui
2023-12-20  6:47   ` Ping-Ke Shih
2023-12-21 14:40   ` Kalle Valo
2023-12-19  6:57 ` Su Hui [this message]
2023-12-19  6:57 ` [PATCH wireless-next 03/11] wifi: rtlwifi: rtl8188ee: phy: using calculate_bit_shift() Su Hui
2023-12-19  6:57 ` [PATCH wireless-next 04/11] wifi: rtlwifi: rtl8192c: " Su Hui
2023-12-19  6:57 ` [PATCH wireless-next 05/11] wifi: rtlwifi: rtl8192cu: " Su Hui
2023-12-19  6:57 ` [PATCH wireless-next 06/11] wifi: rtlwifi: rtl8192ce: " Su Hui
2023-12-19  6:57 ` [PATCH wireless-next 07/11] wifi: rtlwifi: rtl8192de: " Su Hui
2023-12-19  6:57 ` [PATCH wireless-next 08/11] wifi: rtlwifi: rtl8192ee: " Su Hui
2023-12-19  6:57 ` [PATCH wireless-next 09/11] wifi: rtlwifi: rtl8192se: " Su Hui
2023-12-19  6:57 ` [PATCH wireless-next 10/11] wifi: rtlwifi: rtl8723_common: " Su Hui
2023-12-19  6:57 ` [PATCH wireless-next 11/11] wifi: rtlwifi: rtl8723{be,ae}: " Su Hui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231219065739.1895666-3-suhui@nfschina.com \
    --to=suhui@nfschina.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kvalo@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=pkshih@realtek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.