Received: by 2002:a05:7412:8598:b0:f9:33c2:5753 with SMTP id n24csp320526rdh; Mon, 18 Dec 2023 22:58:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IHdHs3okVALPdr4Pt6FquZmv5IAvN5HqAtbeqOABTt6peuO+Xp+NJ5EcIPaLG1EpCRlj90N X-Received: by 2002:a05:6a00:4e48:b0:6d8:19a4:697f with SMTP id gu8-20020a056a004e4800b006d819a4697fmr1324064pfb.47.1702969118944; Mon, 18 Dec 2023 22:58:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702969118; cv=none; d=google.com; s=arc-20160816; b=FIaEobtZzb/APk8fKr7Y1XxEDTi5u9iVwkNRy9bdk1BCUZ36lxubAqkNELlwzhGONA 9O+d8Ac+g0wsp/e/IpInHlQU1iB2iiHHdJypnufWVIVhYuy+pZ6mdYzvG4L/O+G+5aWm 7O17f0QgAWxJcQdWl9NvFc9j+IM1/g6kw55QPuXHEtHdfmHerZHUGQj6eSNVazid3jkc DA3wpYXsh5DWtqdnFKkmuNb70ILSuJmWSdiijI5YjAug/bqCZRJaXbro2QGXEEGWmQga QTBx73tqQt5FLTGWPVCG4dZw/4486Qp0wt+h+To0Fu73GzxZacX9YBwBmxelOXtgneOz z8Kw== 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=8an9yuSMPtU6suEwE244Jlh7o74o77PKu+85qV3QNSY=; fh=MRoo+C8Q51kq1JFxLSuzqTUzw7hVlt4FxOeHj80JRxs=; b=d6MI447xd0r/m16OBiK8I7JyOEOxS7OV/IzYu+1cA08vsdlxo/lTTmnjXHShPKrqVQ n1dHzB2GSuXhK5LCf1NNrFkaj1reCl7ETCR49vtgXiCUSq6NoNN11YuGoOahBDatp1ho ixLBCQBb7rjZSe09AAhtM0A80TM35kaF7Bf6oog52jPdaGFT7UVCB+eJ2JXoP5XNULCG SRfe/eFlM9IIAkPzwKcKnQ6GUrJZ8CjiLz+yj0QzR+hIapUUm+YQR7lIRz03y4hQQtLy XhjQjJKs/LF4+4x3Dk8L7ccX54jkUyOT2UznJcrcvA5UzMrwQBZkR4qIM5ry97Kx8vNE TOMg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless+bounces-953-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-953-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 11-20020a63174b000000b005c66c225696si19212178pgx.63.2023.12.18.22.58.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 22:58:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-953-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless+bounces-953-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-953-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 6B2ACB23210 for ; Tue, 19 Dec 2023 06:58:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 93B478C11; 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 D5F4BF9E8; Tue, 19 Dec 2023 06:58:04 +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 2610F60F259C0; Tue, 19 Dec 2023 14:58:02 +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, chaoming_li@realsil.com.cn, Larry.Finger@lwfinger.net, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH wireless-next 07/11] wifi: rtlwifi: rtl8192de: using calculate_bit_shift() Date: Tue, 19 Dec 2023 14:57:35 +0800 Message-Id: <20231219065739.1895666-8-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 _rtl92d_phy_calculate_bit_shift(). And fix the undefined bitwise shift behavior problem. Fixes: 7274a8c22980 ("rtlwifi: rtl8192de: Merge phy routines") Signed-off-by: Su Hui --- .../net/wireless/realtek/rtlwifi/rtl8192de/phy.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c index d18c092b6142..d835a27429f0 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c @@ -169,13 +169,6 @@ static const u8 channel_all[59] = { 157, 159, 161, 163, 165 }; -static u32 _rtl92d_phy_calculate_bit_shift(u32 bitmask) -{ - u32 i = ffs(bitmask); - - return i ? i - 1 : 32; -} - u32 rtl92d_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask) { struct rtl_priv *rtlpriv = rtl_priv(hw); @@ -198,7 +191,7 @@ u32 rtl92d_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask) } else { originalvalue = rtl_read_dword(rtlpriv, regaddr); } - bitshift = _rtl92d_phy_calculate_bit_shift(bitmask); + bitshift = calculate_bit_shift(bitmask); returnvalue = (originalvalue & bitmask) >> bitshift; rtl_dbg(rtlpriv, COMP_RF, DBG_TRACE, "BBR MASK=0x%x Addr[0x%x]=0x%x\n", @@ -230,7 +223,7 @@ void rtl92d_phy_set_bb_reg(struct ieee80211_hw *hw, dbi_direct); else originalvalue = rtl_read_dword(rtlpriv, regaddr); - bitshift = _rtl92d_phy_calculate_bit_shift(bitmask); + bitshift = calculate_bit_shift(bitmask); data = ((originalvalue & (~bitmask)) | (data << bitshift)); } if (rtlhal->during_mac1init_radioa || rtlhal->during_mac0init_radiob) @@ -317,7 +310,7 @@ u32 rtl92d_phy_query_rf_reg(struct ieee80211_hw *hw, regaddr, rfpath, bitmask); spin_lock(&rtlpriv->locks.rf_lock); original_value = _rtl92d_phy_rf_serial_read(hw, rfpath, regaddr); - bitshift = _rtl92d_phy_calculate_bit_shift(bitmask); + bitshift = calculate_bit_shift(bitmask); readback_value = (original_value & bitmask) >> bitshift; spin_unlock(&rtlpriv->locks.rf_lock); rtl_dbg(rtlpriv, COMP_RF, DBG_TRACE, @@ -343,7 +336,7 @@ void rtl92d_phy_set_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath, if (bitmask != RFREG_OFFSET_MASK) { original_value = _rtl92d_phy_rf_serial_read(hw, rfpath, regaddr); - bitshift = _rtl92d_phy_calculate_bit_shift(bitmask); + bitshift = calculate_bit_shift(bitmask); data = ((original_value & (~bitmask)) | (data << bitshift)); } -- 2.30.2