Received: by 2002:a05:7412:8598:b0:f9:33c2:5753 with SMTP id n24csp320624rdh; Mon, 18 Dec 2023 22:58:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IHqIcYmm12wrzPXvG0XoPiwFXQCGP77YAtg54bkDKbGpGOiHcpk19KyqUgAJREMp6IOGe9e X-Received: by 2002:a17:90a:d252:b0:28b:8955:aa49 with SMTP id o18-20020a17090ad25200b0028b8955aa49mr658743pjw.48.1702969135555; Mon, 18 Dec 2023 22:58:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702969135; cv=none; d=google.com; s=arc-20160816; b=C5ERe97AjCWfrw8W+BrgMqwg3/kh6JDB8OuhoI3Gp6dmXKFwA1+bu91swOpd3xaDMA 3i46doJhwUPw1pnF1e1hrAutNav8eCXTRBVj81xRGgvs2W4qdQF9OpLxjfmc7D4T8cuV k2/Y7Xxt/htMQgoaC95RQqzmyloBbOjoGb0251ql60+DU5iX+H7vkzbsuXmTdoPwME1i F/9RLbubs0aXOU4e9sJLwvRKoFgPJ9sJCYn5gS7hSvmL6OKsEaCdQhoXnjkIeOr+d+tr 2bw+WyjcXMbqiXbgjXvaUKjLNgMDMZgVdlNRk5/wu7DlvtRuY0XcC8YGhs0kR1xkFgD/ 4bKQ== 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=XXHK2jd3xxXTgcSiAzj2VVYIhxKduSLrVT3qqhz9b3M=; fh=LUYBtLOSfwANM0G8xcuNzxmAdvH3wjuyldpKgyGS4VQ=; b=YdY1WuNnJckfxOTDhZHUO+dOkJJcSI+P9er97UJ/Z0GomhMg+8Yt6EW/KLw0UqK6O2 EBcU0veqDU8iLe64uheB25qGHJIJAo2SpfAMP449VhPQOU2Ejw0Oql9AMomrSI61kSw1 /UBXi513/nYsGeumBhuodjTQnjgMKGtMWUCl3UfmPj+I8hTnQJTCqEiuEJDkqVJuZ7kX 0R4PG7w0Aifa8ttOiaI2iAl8X8adF+eoy8ORP+Xh422tr7MD2qtUzwjnSGejzf3CWdcl ntRq6K7ANwVSig1jKpuH/4sVFfiY4+O8gQceQqMIajFAN0CY2n6wfjr2lzcrz+NONqzm 1w5w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-4766-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4766-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 d88-20020a17090a6f6100b0028bbd0e8cf5si527761pjk.182.2023.12.18.22.58.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 22:58:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-4766-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-kernel+bounces-4766-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4766-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 37A9C2861FB for ; Tue, 19 Dec 2023 06:58:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8C47B1171C; Tue, 19 Dec 2023 06:58:10 +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 AF3F4F9F5; Tue, 19 Dec 2023 06:58:06 +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 5312F60F259C0; Tue, 19 Dec 2023 14:58:03 +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 , Larry.Finger@lwfinger.net, linville@tuxdriver.com, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH wireless-next 08/11] wifi: rtlwifi: rtl8192ee: using calculate_bit_shift() Date: Tue, 19 Dec 2023 14:57:36 +0800 Message-Id: <20231219065739.1895666-9-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 _rtl92ee_phy_calculate_bit_shift(). And fix the undefined bitwise shift behavior problem. Fixes: b1a3bfc97cd9 ("rtlwifi: rtl8192ee: Move driver from staging to the regular tree") Signed-off-by: Su Hui --- .../net/wireless/realtek/rtlwifi/rtl8192ee/phy.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/phy.c index cc0bcaf13e96..73ef602bfb01 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/phy.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/phy.c @@ -16,7 +16,6 @@ static u32 _rtl92ee_phy_rf_serial_read(struct ieee80211_hw *hw, static void _rtl92ee_phy_rf_serial_write(struct ieee80211_hw *hw, enum radio_path rfpath, u32 offset, u32 data); -static u32 _rtl92ee_phy_calculate_bit_shift(u32 bitmask); static bool _rtl92ee_phy_bb8192ee_config_parafile(struct ieee80211_hw *hw); static bool _rtl92ee_phy_config_mac_with_headerfile(struct ieee80211_hw *hw); static bool phy_config_bb_with_hdr_file(struct ieee80211_hw *hw, @@ -46,7 +45,7 @@ u32 rtl92ee_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 = _rtl92ee_phy_calculate_bit_shift(bitmask); + bitshift = calculate_bit_shift(bitmask); returnvalue = (originalvalue & bitmask) >> bitshift; rtl_dbg(rtlpriv, COMP_RF, DBG_TRACE, @@ -68,7 +67,7 @@ void rtl92ee_phy_set_bb_reg(struct ieee80211_hw *hw, u32 regaddr, if (bitmask != MASKDWORD) { originalvalue = rtl_read_dword(rtlpriv, regaddr); - bitshift = _rtl92ee_phy_calculate_bit_shift(bitmask); + bitshift = calculate_bit_shift(bitmask); data = ((originalvalue & (~bitmask)) | (data << bitshift)); } @@ -92,7 +91,7 @@ u32 rtl92ee_phy_query_rf_reg(struct ieee80211_hw *hw, spin_lock(&rtlpriv->locks.rf_lock); original_value = _rtl92ee_phy_rf_serial_read(hw , rfpath, regaddr); - bitshift = _rtl92ee_phy_calculate_bit_shift(bitmask); + bitshift = calculate_bit_shift(bitmask); readback_value = (original_value & bitmask) >> bitshift; spin_unlock(&rtlpriv->locks.rf_lock); @@ -119,7 +118,7 @@ void rtl92ee_phy_set_rf_reg(struct ieee80211_hw *hw, if (bitmask != RFREG_OFFSET_MASK) { original_value = _rtl92ee_phy_rf_serial_read(hw, rfpath, addr); - bitshift = _rtl92ee_phy_calculate_bit_shift(bitmask); + bitshift = calculate_bit_shift(bitmask); data = (original_value & (~bitmask)) | (data << bitshift); } @@ -201,13 +200,6 @@ static void _rtl92ee_phy_rf_serial_write(struct ieee80211_hw *hw, pphyreg->rf3wire_offset, data_and_addr); } -static u32 _rtl92ee_phy_calculate_bit_shift(u32 bitmask) -{ - u32 i = ffs(bitmask); - - return i ? i - 1 : 32; -} - bool rtl92ee_phy_mac_config(struct ieee80211_hw *hw) { return _rtl92ee_phy_config_mac_with_headerfile(hw); -- 2.30.2