Received: by 2002:a05:7412:8598:b0:f9:33c2:5753 with SMTP id n24csp322442rdh; Mon, 18 Dec 2023 23:02:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IGe2WELOBKLFDiG5dQhnB6dVQxruZrkgL7psDtWLMw3JrCWXPnXNJq9i6xxLH+Zlhrh7izT X-Received: by 2002:a05:6214:1c45:b0:67f:7aa:2b75 with SMTP id if5-20020a0562141c4500b0067f07aa2b75mr13449434qvb.104.1702969342920; Mon, 18 Dec 2023 23:02:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702969342; cv=none; d=google.com; s=arc-20160816; b=x09DtxdGzz1ElInuL9OkqUhFfDBRqtLlbQU03q9XylfxE8vLKf/RVyiA73GbVUyXSQ ilDgasLqo+zhEutVAzo4Y2WGHdjM5OZQhVyc3rZaoUhlUvItCfXGGRbjtbukWFX0DczD S5B0+59SyvoXHz8NonwREi1/cB38yO+sVmwxPdxq8J9ldWZ97FIRAU9IGtKWUbzLQOqQ nJ2G5vKdpN0W0/sWHVgCTPvhXszRwiyV9hWXBj8pFzS4Jm4cHomMFiK9Y/LHsTLaYPHn vKnQ2QMC0NYQoXVXHTu1/zIAq8Ifwk6F/tDsut8/tkN7ZSFZ9zGTOWqu4dTUUuaBl6pw 4P2g== 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=ICIBwKlU7JYIZrO0jxtRuKprv0M48qLWWYaY2gStL6g=; fh=2fCra+QI2qh0halP4Kp2qkpSMAyuATPLuCZ8W27+ut0=; b=D+YXP6xGnwI3BbBqzo1GyAHM8AGOb5ZjN9dT8N26IOhjJ8hUbh9CWzwCB7C3l4kYRf 6UI8etXULC36Qc7TwIUbbHqLYow/X2W2RLwoJx80Q/tY+QHkc6J4uRjJV/6cJxay4BcE FmA6yWpOnEwuz3AQIJHm8pyOl5FS6YB9Jvj9rAbHoAFUA3IsmdSLKYzseK/IvENIqVU8 NNEolffOmDlkyeScR7LB3XXTqZUsN2Jf/8T3BUQXNR08rc3gszPWV/5Y2d/o/nZCevSX E07sR85rLLvmNfMM4a4OyLbaFzXNJ4oJC0etVq5G9O/GHkzHPPIh0ds2Mp5CQ+F0oLUV 9G5Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-4775-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4775-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id s11-20020a0cdc0b000000b0067f2a5ee0absi6830638qvk.271.2023.12.18.23.02.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 23:02:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-4775-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-4775-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4775-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id A85CC1C23041 for ; Tue, 19 Dec 2023 07:02:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 88FF5182C6; Tue, 19 Dec 2023 06:58:43 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from mail.nfschina.com (unknown [42.101.60.195]) by smtp.subspace.kernel.org (Postfix) with SMTP id 981798829; Tue, 19 Dec 2023 06:58:40 +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 2BFBF60F259C3; Tue, 19 Dec 2023 14:58:07 +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 , 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 10/11] wifi: rtlwifi: rtl8723_common: using calculate_bit_shift() Date: Tue, 19 Dec 2023 14:57:38 +0800 Message-Id: <20231219065739.1895666-11-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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Using calculate_bit_shift() to replace rtl8723_phy_calculate_bit_shift(). And fix the undefined bitwise shift behavior problem. Fixes: 0a168b48cdf7 ("rtlwifi: rtl8723ae: rtl8723-common: Create new driver for common code") Signed-off-by: Su Hui --- .../wireless/realtek/rtlwifi/rtl8723com/phy_common.c | 12 ++---------- .../wireless/realtek/rtlwifi/rtl8723com/phy_common.h | 1 - 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723com/phy_common.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723com/phy_common.c index 47b6c1aa36b0..d97c88ebce75 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723com/phy_common.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723com/phy_common.c @@ -17,7 +17,7 @@ u32 rtl8723_phy_query_bb_reg(struct ieee80211_hw *hw, rtl_dbg(rtlpriv, COMP_RF, DBG_TRACE, "regaddr(%#x), bitmask(%#x)\n", regaddr, bitmask); originalvalue = rtl_read_dword(rtlpriv, regaddr); - bitshift = rtl8723_phy_calculate_bit_shift(bitmask); + bitshift = calculate_bit_shift(bitmask); returnvalue = (originalvalue & bitmask) >> bitshift; rtl_dbg(rtlpriv, COMP_RF, DBG_TRACE, @@ -39,7 +39,7 @@ void rtl8723_phy_set_bb_reg(struct ieee80211_hw *hw, u32 regaddr, if (bitmask != MASKDWORD) { originalvalue = rtl_read_dword(rtlpriv, regaddr); - bitshift = rtl8723_phy_calculate_bit_shift(bitmask); + bitshift = calculate_bit_shift(bitmask); data = ((originalvalue & (~bitmask)) | (data << bitshift)); } @@ -51,14 +51,6 @@ void rtl8723_phy_set_bb_reg(struct ieee80211_hw *hw, u32 regaddr, } EXPORT_SYMBOL_GPL(rtl8723_phy_set_bb_reg); -u32 rtl8723_phy_calculate_bit_shift(u32 bitmask) -{ - u32 i = ffs(bitmask); - - return i ? i - 1 : 32; -} -EXPORT_SYMBOL_GPL(rtl8723_phy_calculate_bit_shift); - u32 rtl8723_phy_rf_serial_read(struct ieee80211_hw *hw, enum radio_path rfpath, u32 offset) { diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723com/phy_common.h b/drivers/net/wireless/realtek/rtlwifi/rtl8723com/phy_common.h index edf1c52f0ee2..af85c3287507 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723com/phy_common.h +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723com/phy_common.h @@ -27,7 +27,6 @@ u32 rtl8723_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask); void rtl8723_phy_set_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask, u32 data); -u32 rtl8723_phy_calculate_bit_shift(u32 bitmask); u32 rtl8723_phy_rf_serial_read(struct ieee80211_hw *hw, enum radio_path rfpath, u32 offset); void rtl8723_phy_rf_serial_write(struct ieee80211_hw *hw, -- 2.30.2