Received: by 2002:a05:7412:8598:b0:f9:33c2:5753 with SMTP id n24csp321927rdh; Mon, 18 Dec 2023 23:01:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IElQ+0zNARUqrUp0Sl0XO8/qze+JJvUtXWsnBihmogjyWUGOoA7m/QRBY68gmm6xhVovPiW X-Received: by 2002:aa7:880e:0:b0:6d9:30b4:3247 with SMTP id c14-20020aa7880e000000b006d930b43247mr741714pfo.18.1702969292149; Mon, 18 Dec 2023 23:01:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702969292; cv=none; d=google.com; s=arc-20160816; b=DpTOkSJkXY7OKWIsUZpjOJct8Ffiav4SdLJAP6sJXPenyIoNl6xb0JOMJmuAMMTlNf DN+ULvWvg486aqsWLVPNjIZusfeqDZjRNhGjY/eCtVcXK6WK15/72kIKoL9jaZb8Tmo6 Je+ej0+UboYtVvqfFqIu351QCmdJeJtUSVEecBLrUjgVz3xXB2etEe2xjMvCRVBezyM3 63U4O6jp8Q3R8r02EqM/QW6T2+4Ufk3p0Ba7Aro+AYnBF5rtxonsjH0wqUUXaN6v+/Lk pnvcc1ymOkpERcruviwyU+VfEsVPwvH9xZbo7ufa1LWYvx4gKqtrnDr1Th7Rg39XyMuJ 4j2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:in-reply-to:message-id:date :subject:cc:to:from; bh=K86nl6gWmGNnr8AF0KfK7x3mGvAKFY+3fsQyj4iKxSM=; fh=R3kMZysjL0IWLIMAVvEuc+69vhTiFeL0nOUtVQKCXxk=; b=ULRopSKqxEmtJUbmzP+di0yzrDzLGUQXGTSMo//2g9E+756ZewtfX+zg0eNwhnRsBO 3szzWQptbWU3yqxfBoEZ5YpFY2nH3OOBzez8LCUsk3MapIXj2Y4feEbqdVP898DkWWNR X7uMX8doEThdWO7ziWxc/FMMr+L6JA4sy41HNLrojO7bwpODodojzMqyH9H13zGwszi9 MZLMJJFrxG66Y4JIyOmveRmcwjd/ikod7DvoDIMi+poN5JNDKuRseDtD5wjVj3BgVO8k n/khe3uUZracs+jo4p6nf/XWbgXU/HV1hUucmW0mIgNJEjxId5Ao5igsOSjNxsRdFbQu sn0w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless+bounces-961-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-961-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id fj36-20020a056a003a2400b006ce702c02absi18983106pfb.159.2023.12.18.23.01.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 23:01:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-961-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless+bounces-961-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-961-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C957F2818FE for ; Tue, 19 Dec 2023 07:01:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CE734848D; Tue, 19 Dec 2023 06:58:15 +0000 (UTC) X-Original-To: linux-wireless@vger.kernel.org Received: from mail.nfschina.com (unknown [42.101.60.195]) by smtp.subspace.kernel.org (Postfix) with SMTP id AB8B611C88; Tue, 19 Dec 2023 06:58:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nfschina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nfschina.com Received: from localhost.localdomain (unknown [180.167.10.98]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPSA id 7E0F260F259C2; Tue, 19 Dec 2023 14:58:04 +0800 (CST) X-MD-Sfrom: suhui@nfschina.com X-MD-SrcIP: 180.167.10.98 From: Su Hui To: pkshih@realtek.com, kvalo@kernel.org Cc: Su Hui , chaoming_li@realsil.com.cn, linville@tuxdriver.com, Larry.Finger@lwfinger.net, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH wireless-next 09/11] wifi: rtlwifi: rtl8192se: using calculate_bit_shift() Date: Tue, 19 Dec 2023 14:57:37 +0800 Message-Id: <20231219065739.1895666-10-suhui@nfschina.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231219065739.1895666-1-suhui@nfschina.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Using calculate_bit_shift() to replace _rtl92s_phy_calculate_bit_shift(). And fix the undefined bitwise shift behavior problem. Fixes: d15853163bea ("rtlwifi: rtl8192se: Merge phy routines") Signed-off-by: Su Hui --- .../net/wireless/realtek/rtlwifi/rtl8192se/phy.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/phy.c index 09591a0b5a81..d9ef7e1da1db 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/phy.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/phy.c @@ -14,13 +14,6 @@ #include "hw.h" #include "table.h" -static u32 _rtl92s_phy_calculate_bit_shift(u32 bitmask) -{ - u32 i = ffs(bitmask); - - return i ? i - 1 : 32; -} - u32 rtl92s_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask) { struct rtl_priv *rtlpriv = rtl_priv(hw); @@ -30,7 +23,7 @@ u32 rtl92s_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask) regaddr, bitmask); originalvalue = rtl_read_dword(rtlpriv, regaddr); - bitshift = _rtl92s_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", @@ -52,7 +45,7 @@ void rtl92s_phy_set_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask, if (bitmask != MASKDWORD) { originalvalue = rtl_read_dword(rtlpriv, regaddr); - bitshift = _rtl92s_phy_calculate_bit_shift(bitmask); + bitshift = calculate_bit_shift(bitmask); data = ((originalvalue & (~bitmask)) | (data << bitshift)); } @@ -157,7 +150,7 @@ u32 rtl92s_phy_query_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath, original_value = _rtl92s_phy_rf_serial_read(hw, rfpath, regaddr); - bitshift = _rtl92s_phy_calculate_bit_shift(bitmask); + bitshift = calculate_bit_shift(bitmask); readback_value = (original_value & bitmask) >> bitshift; spin_unlock(&rtlpriv->locks.rf_lock); @@ -188,7 +181,7 @@ void rtl92s_phy_set_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath, if (bitmask != RFREG_OFFSET_MASK) { original_value = _rtl92s_phy_rf_serial_read(hw, rfpath, regaddr); - bitshift = _rtl92s_phy_calculate_bit_shift(bitmask); + bitshift = calculate_bit_shift(bitmask); data = ((original_value & (~bitmask)) | (data << bitshift)); } -- 2.30.2