Received: by 2002:a05:7412:8598:b0:f9:33c2:5753 with SMTP id n24csp320420rdh; Mon, 18 Dec 2023 22:58:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IEt49GDxszlAMXMCojI2+V+bko0tr3U8qzdsUw6Qjy0oC5lVJsNLrVSJjc1xLZUWFF7CyeL X-Received: by 2002:a05:6a00:6ca1:b0:6d7:b46d:16bd with SMTP id jc33-20020a056a006ca100b006d7b46d16bdmr1775747pfb.6.1702969097428; Mon, 18 Dec 2023 22:58:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702969097; cv=none; d=google.com; s=arc-20160816; b=t4UNGenVhZJpE0JrPZGd2dRIQVCSuFRLWZIs3Fl5s9GnEvE5yuA+Nf5j3XdCCPrzNe z+tE+ihhxIRpijjXM59319suRhM0EQQ5ygLUJ7/93giPzfAPNaxDmvGzgLB3ZDTYryrF AWxVokuzzli2TkXVModYXYjvp3tVY0uRMFzGiDXibBd+SMZrI2C2uGxPJNlXf5VEWB7h u/ZOhUNda8cu5ASD3qCyomkOTOaDL0GOIl2lK471aBy3ozSXRFDksZ5CK9fuLK4Qtr2F nvrGSWGqMAOycozfzvT9SuZui1Qcu0aEfddZnZbVD2kt1dmIg5B+Bb/rlMzqo1nXlujt hAYw== 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=UOh5h24g0BJdU8iEDJwwLUae+S+85BsXEhAJGzHZL2w=; fh=2fCra+QI2qh0halP4Kp2qkpSMAyuATPLuCZ8W27+ut0=; b=BFUZOit1uLF3QzaDl1DBHoFhHJIspRu/9uRZrG4vnhfviFxmVmJeD9lO7INciovat+ RLDBq70sKZ2xRCfPLLERCiv6eY6wUrDCVSGnWw8jY3aZETlIHas3UTSTlK3QPi/Urdpk acXZKJRPBXka3VXwfqGNasGOj7lXChB7mCsZa5QGU2jpqONo5Paj7xbJxtcbk0Cx4xs8 cNwIrqau+6jDF33l0c+zRlWGo01azX5RYb+JrmpiR0PUGOSXvKdjkioYoG2/OYZmwvTO VEzUkK+dzjBYbAcde0evgiSwuCvfyRGPCkDNm1m7qtogzZyGzDykTZ7Vyv3TALuMt4K9 b5gg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless+bounces-952-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-wireless+bounces-952-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id bz19-20020a056a02061300b005cd90f5bc6dsi3880239pgb.455.2023.12.18.22.58.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 22:58:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-952-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless+bounces-952-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-wireless+bounces-952-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id A613AB22A86 for ; Tue, 19 Dec 2023 06:58:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0958B8480; Tue, 19 Dec 2023 06:58:09 +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 E6701F9E7; Tue, 19 Dec 2023 06:58:03 +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 9B70460F259C3; Tue, 19 Dec 2023 14:57:58 +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 04/11] wifi: rtlwifi: rtl8192c: using calculate_bit_shift() Date: Tue, 19 Dec 2023 14:57:32 +0800 Message-Id: <20231219065739.1895666-5-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 _rtl92c_phy_calculate_bit_shift(). And fix the undefined bitwise shift behavior problem. Fixes: 4295cd254af3 ("rtlwifi: Move common parts of rtl8192ce/phy.c") Signed-off-by: Su Hui --- .../wireless/realtek/rtlwifi/rtl8192c/phy_common.c | 12 ++---------- .../wireless/realtek/rtlwifi/rtl8192c/phy_common.h | 1 - 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/phy_common.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/phy_common.c index 3d29c8dbb255..144ee780e1b6 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/phy_common.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/phy_common.c @@ -17,7 +17,7 @@ u32 rtl92c_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask) rtl_dbg(rtlpriv, COMP_RF, DBG_TRACE, "regaddr(%#x), bitmask(%#x)\n", regaddr, bitmask); originalvalue = rtl_read_dword(rtlpriv, regaddr); - bitshift = _rtl92c_phy_calculate_bit_shift(bitmask); + bitshift = calculate_bit_shift(bitmask); returnvalue = (originalvalue & bitmask) >> bitshift; rtl_dbg(rtlpriv, COMP_RF, DBG_TRACE, @@ -40,7 +40,7 @@ void rtl92c_phy_set_bb_reg(struct ieee80211_hw *hw, if (bitmask != MASKDWORD) { originalvalue = rtl_read_dword(rtlpriv, regaddr); - bitshift = _rtl92c_phy_calculate_bit_shift(bitmask); + bitshift = calculate_bit_shift(bitmask); data = ((originalvalue & (~bitmask)) | (data << bitshift)); } @@ -143,14 +143,6 @@ void _rtl92c_phy_rf_serial_write(struct ieee80211_hw *hw, } EXPORT_SYMBOL(_rtl92c_phy_rf_serial_write); -u32 _rtl92c_phy_calculate_bit_shift(u32 bitmask) -{ - u32 i = ffs(bitmask); - - return i ? i - 1 : 32; -} -EXPORT_SYMBOL(_rtl92c_phy_calculate_bit_shift); - static void _rtl92c_phy_bb_config_1t(struct ieee80211_hw *hw) { rtl_set_bbreg(hw, RFPGA0_TXINFO, 0x3, 0x2); diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/phy_common.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/phy_common.h index 75afa6253ad0..e64d377dfe9e 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/phy_common.h +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/phy_common.h @@ -196,7 +196,6 @@ bool rtl92c_phy_set_rf_power_state(struct ieee80211_hw *hw, void rtl92ce_phy_set_rf_on(struct ieee80211_hw *hw); void rtl92c_phy_set_io(struct ieee80211_hw *hw); void rtl92c_bb_block_on(struct ieee80211_hw *hw); -u32 _rtl92c_phy_calculate_bit_shift(u32 bitmask); long _rtl92c_phy_txpwr_idx_to_dbm(struct ieee80211_hw *hw, enum wireless_mode wirelessmode, u8 txpwridx); -- 2.30.2