Received: by 2002:a05:7412:8598:b0:f9:33c2:5753 with SMTP id n24csp320707rdh; Mon, 18 Dec 2023 22:59:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IHK9CeOUaJsGN7AKA93FwDM6fqCF2r3nZW8FA8o+wRtJVE7+emQ6IgvBi6DTaT6JSxH6TRe X-Received: by 2002:a17:906:1de:b0:a23:5a0a:aeba with SMTP id 30-20020a17090601de00b00a235a0aaebamr1445058ejj.68.1702969150870; Mon, 18 Dec 2023 22:59:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702969150; cv=none; d=google.com; s=arc-20160816; b=JtVkMWKd4TwD8tq0zAgGiwzWKPK81MUrsl22Y/GAVabo8FDXB60HFfdi+LhpABKgDt ifCRsu5oaeto5LwhMFGdFsRaV0Kxiz4zUURzFWf35aqvf77uOxjGbkgixYtOoqQQ/LGu 2cz2D0Kwb+3mrriim47dX8woyUQgYgoNuUhFTMDe4xiQ7aqjWWSlnIs8kf++YhHgG1u6 eqZ8iQMnyk9BgmQjscLy9XVVyM+WPM5yTyJTlUWilwe89d5M9VthT+PbIboLoIHvN++j dyXcEe9xlvW6Y55DOS3Tw2WUYA/z+7A0YHe24qPtFeWESCP43Gdn9GCsCTrqdVEkRVBB 5fVg== 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=3E3zlH4OAWkl6SEDl6xRfIlRojsm0kxSZs6/4+GdrI0=; fh=LUYBtLOSfwANM0G8xcuNzxmAdvH3wjuyldpKgyGS4VQ=; b=YucHXb+4hVH1Zy7tTB6NqfLq/liNuGRXmAwXHAu///b3XRtzZ3r9y5kFrsalvCSRU1 pYeZayeWc7RkR9HTDhT+emnn4WcunKeVp59MrrbT8R/r82rNeLUJv2KMWNFVR6WejNPQ gwui/OFY7HGPpcVjGkxXD5qq2h44jW5Vto31cS7rnQUEYdmzaoYA+ONS+Ic81sDF3LOi aJqYQ3SrJgwAeodjXOlD/kc9WLMuQnMHSRcjOa+6/QhtHZGCgPDhXTJhu3351d85n4mj 7MiJFJh8MkPKO09p4i8orkVtBWRsjzv0EdzORzKO80n3+X57jAH0+JVb8sW4ANdgxkkY ZGcQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless+bounces-955-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-955-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id c19-20020a17090603d300b00a2371bd6045si477826eja.668.2023.12.18.22.59.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 22:59:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-955-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless+bounces-955-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-955-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 9AEE01F24262 for ; Tue, 19 Dec 2023 06:59:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2B83C125C2; Tue, 19 Dec 2023 06:58:11 +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 316E8101D9; 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 454E460F259C2; Tue, 19 Dec 2023 14:57:57 +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 03/11] wifi: rtlwifi: rtl8188ee: phy: using calculate_bit_shift() Date: Tue, 19 Dec 2023 14:57:31 +0800 Message-Id: <20231219065739.1895666-4-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 _rtl88e_phy_calculate_bit_shift(). And fix the undefined bitwise shift behavior problem. Fixes: f0eb856e0b6c ("rtlwifi: rtl8188ee: Add new driver") Signed-off-by: Su Hui --- .../net/wireless/realtek/rtlwifi/rtl8188ee/phy.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.c index 12d0b3a87af7..0fab3a0c7d49 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.c @@ -16,12 +16,6 @@ static u32 _rtl88e_phy_rf_serial_read(struct ieee80211_hw *hw, static void _rtl88e_phy_rf_serial_write(struct ieee80211_hw *hw, enum radio_path rfpath, u32 offset, u32 data); -static u32 _rtl88e_phy_calculate_bit_shift(u32 bitmask) -{ - u32 i = ffs(bitmask); - - return i ? i - 1 : 32; -} static bool _rtl88e_phy_bb8188e_config_parafile(struct ieee80211_hw *hw); static bool _rtl88e_phy_config_mac_with_headerfile(struct ieee80211_hw *hw); static bool phy_config_bb_with_headerfile(struct ieee80211_hw *hw, @@ -51,7 +45,7 @@ u32 rtl88e_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 = _rtl88e_phy_calculate_bit_shift(bitmask); + bitshift = calculate_bit_shift(bitmask); returnvalue = (originalvalue & bitmask) >> bitshift; rtl_dbg(rtlpriv, COMP_RF, DBG_TRACE, @@ -74,7 +68,7 @@ void rtl88e_phy_set_bb_reg(struct ieee80211_hw *hw, if (bitmask != MASKDWORD) { originalvalue = rtl_read_dword(rtlpriv, regaddr); - bitshift = _rtl88e_phy_calculate_bit_shift(bitmask); + bitshift = calculate_bit_shift(bitmask); data = ((originalvalue & (~bitmask)) | (data << bitshift)); } @@ -99,7 +93,7 @@ u32 rtl88e_phy_query_rf_reg(struct ieee80211_hw *hw, original_value = _rtl88e_phy_rf_serial_read(hw, rfpath, regaddr); - bitshift = _rtl88e_phy_calculate_bit_shift(bitmask); + bitshift = calculate_bit_shift(bitmask); readback_value = (original_value & bitmask) >> bitshift; spin_unlock(&rtlpriv->locks.rf_lock); @@ -127,7 +121,7 @@ void rtl88e_phy_set_rf_reg(struct ieee80211_hw *hw, original_value = _rtl88e_phy_rf_serial_read(hw, rfpath, regaddr); - bitshift = _rtl88e_phy_calculate_bit_shift(bitmask); + bitshift = calculate_bit_shift(bitmask); data = ((original_value & (~bitmask)) | (data << bitshift)); -- 2.30.2