Received: by 2002:a05:7412:8598:b0:f9:33c2:5753 with SMTP id n24csp320865rdh; Mon, 18 Dec 2023 22:59:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IFlFwKFgFVXG2FtxDZHDj2ulCG9cv2caf66bYv77UplEzYoxgr7Twj40xfJ/WNb81Q+PgbB X-Received: by 2002:a05:6e02:15cb:b0:35d:59a2:2cf with SMTP id q11-20020a056e0215cb00b0035d59a202cfmr28961086ilu.111.1702969179171; Mon, 18 Dec 2023 22:59:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702969179; cv=none; d=google.com; s=arc-20160816; b=bfkt1xiKEA7Kv77ZbZniRJaI0NigR2YcjTuJFfT32KAuYZHHg7Hm1COELSfCN2WjUp HNJ0GUZQLiJ69PKUIPJO7vyJjMpkYI6Ssv+KliQavnbW8QR+urkCU3nyMleHqNiRT/y2 Pn3IKfO6OtnuYNIqi7XFhhxDF3nZgvtKq+vg5XrJMLpA71ZoXU3d6kMDG67p0/7m1WmS /XhJKro/giImAH55oDPmNajjcxrEZx7MnsgW8oZf8bmC1c+jzgt4GfohZjoww8PWjyc1 SuLnNneKUrvMYgSVVo9/xzSIL3vz8yhFvbC+FmVJtupu1GG+Nf+aXF8TQaT+vgcFTcgL AUVA== 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=OXXEXbSOIsLyrzRY5ZkvijwpNQBaTPPxydb9P1IM7EA=; fh=oAKK2Tmfich+PEAEhU13cYP9znewSj73CMUuWFedCmY=; b=rtON5aXTpvBwVyiQCz9v3oV/+kSjtkSXHU5Qly6g/XcF4GHZZuolRrNz/WNc8YM3b8 JD8cPtKb7Mvkx+pvBBJsvZ4ucji8KiSmYy07Mg80Wbmb/HGp5RRoRx7T8AKUmEhdrVy2 1r6VCSy50YF7p4GwUXYWe5lieukYO4rTM0aMu3YJHkWIyhoVuXs5gClDgpMBMrWJ+SdR 6YrrrP37eANU7SGWIBkSSYDmFTtQrKoLQ0dpvD2RAjHdG9r2732CGYxJNmva1tdy6yOs 1l12+iGSYZikeRCbSO3DC+ZIDjXEF8IaxpwfHM7N0JJWOEWls+BNx9rP8s7vNK1ybbO6 qpaw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless+bounces-956-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-956-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 j4-20020a654304000000b005c677a35320si18612833pgq.479.2023.12.18.22.59.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 22:59:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-956-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-956-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-956-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 4BF86281BA3 for ; Tue, 19 Dec 2023 06:59:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7F3D4C144; Tue, 19 Dec 2023 06:58:12 +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 6F9CB107B7; Tue, 19 Dec 2023 06:58:07 +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 1BDF360F259C0; Tue, 19 Dec 2023 14:57:56 +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 , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH wireless-next 02/11] wifi: rtlwifi: rtl8821ae: phy: using calculate_bit_shift() Date: Tue, 19 Dec 2023 14:57:30 +0800 Message-Id: <20231219065739.1895666-3-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 _rtl8821ae_phy_calculate_bit_shift(). Signed-off-by: Su Hui --- .../net/wireless/realtek/rtlwifi/rtl8821ae/phy.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c index 68c3fb0395ce..1be51ea3f3c8 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c @@ -27,13 +27,6 @@ static u32 _rtl8821ae_phy_rf_serial_read(struct ieee80211_hw *hw, static void _rtl8821ae_phy_rf_serial_write(struct ieee80211_hw *hw, enum radio_path rfpath, u32 offset, u32 data); -static u32 _rtl8821ae_phy_calculate_bit_shift(u32 bitmask) -{ - if (WARN_ON_ONCE(!bitmask)) - return 0; - - return __ffs(bitmask); -} static bool _rtl8821ae_phy_bb8821a_config_parafile(struct ieee80211_hw *hw); /*static bool _rtl8812ae_phy_config_mac_with_headerfile(struct ieee80211_hw *hw);*/ static bool _rtl8821ae_phy_config_mac_with_headerfile(struct ieee80211_hw *hw); @@ -106,7 +99,7 @@ u32 rtl8821ae_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr, "regaddr(%#x), bitmask(%#x)\n", regaddr, bitmask); originalvalue = rtl_read_dword(rtlpriv, regaddr); - bitshift = _rtl8821ae_phy_calculate_bit_shift(bitmask); + bitshift = calculate_bit_shift(bitmask); returnvalue = (originalvalue & bitmask) >> bitshift; rtl_dbg(rtlpriv, COMP_RF, DBG_TRACE, @@ -127,7 +120,7 @@ void rtl8821ae_phy_set_bb_reg(struct ieee80211_hw *hw, if (bitmask != MASKDWORD) { originalvalue = rtl_read_dword(rtlpriv, regaddr); - bitshift = _rtl8821ae_phy_calculate_bit_shift(bitmask); + bitshift = calculate_bit_shift(bitmask); data = ((originalvalue & (~bitmask)) | ((data << bitshift) & bitmask)); } @@ -153,7 +146,7 @@ u32 rtl8821ae_phy_query_rf_reg(struct ieee80211_hw *hw, spin_lock(&rtlpriv->locks.rf_lock); original_value = _rtl8821ae_phy_rf_serial_read(hw, rfpath, regaddr); - bitshift = _rtl8821ae_phy_calculate_bit_shift(bitmask); + bitshift = calculate_bit_shift(bitmask); readback_value = (original_value & bitmask) >> bitshift; spin_unlock(&rtlpriv->locks.rf_lock); @@ -181,7 +174,7 @@ void rtl8821ae_phy_set_rf_reg(struct ieee80211_hw *hw, if (bitmask != RFREG_OFFSET_MASK) { original_value = _rtl8821ae_phy_rf_serial_read(hw, rfpath, regaddr); - bitshift = _rtl8821ae_phy_calculate_bit_shift(bitmask); + bitshift = calculate_bit_shift(bitmask); data = ((original_value & (~bitmask)) | (data << bitshift)); } -- 2.30.2