Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp1903274imn; Mon, 1 Aug 2022 04:35:51 -0700 (PDT) X-Google-Smtp-Source: AA6agR51WV05IhOrlcANrsafOATMAH1Dfi+Hy7QFr2kZVk8vSJgB3aZ7vuFm3HNwCwuDnCqnMb1p X-Received: by 2002:a17:907:94c3:b0:730:9641:8dd8 with SMTP id dn3-20020a17090794c300b0073096418dd8mr894823ejc.586.1659353750850; Mon, 01 Aug 2022 04:35:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659353750; cv=none; d=google.com; s=arc-20160816; b=v/d57VhB2C5sxHLzVBmHf57oMjVZ0hmXXdtt7fj+o1OdK0UE1ovZlY92DXOuaeKmot rWVadBj1iyr6OTvtwTyhnU7/kjxdG82wie8Cg6iBnVNjKq4PdHbWnXq1fiGncbxRSDDT BXClUL3R4uVfNgAMd+kazlv0zfmOGSAmdgEEsS7q/63+a/faSyhej9CdYaaNZ32onQss lCD/tHPRDmhCTUQuf0+/lsyRmF/RNlEXHUQNTB7ApV0dQl0H90LQDPXEK19WogvKMWoz bxYWajR9w7+AuAf1fVZtPh6KgD66ymHwnQ32x1HnjlhreOxlDn2SRf+2hDcsG1KafY8V Ze6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:authenticated-by; bh=vJ/mZZFoIPIQTHovnix1FMjqk0tqGEN4cnV0QXnNRdY=; b=sUYuNFKzrf7rNR/A6jH9/4PVlR6hHDL+7ru9KbM+qj2XIZPVVS7RtNbWf3DzE9jw+T XIES3fjH4R13wK80aEoxCzUvYgwFg5H6O+7TCwEb2Ps9TKF7jcHoxMcyo2iwPendIvEI W3gvxGkFXZSlFQQ3GNoD8C0UEWKodz59O8cETW3tikhl0qYokA99Ez6D3M7v3tIzeeDu unlDVpoayY0E4Rq7Cr8pkRPw5nEmON721rF+nkrJ64yqL4hQseKmzEWwd+J7XuMxbKB8 4uh9z57SOvNGxrLm6eeTvJNZ+Qdr8BoYry+czmUGLinZMEeaO4tQiveqosvpaZSow2m+ L+Yg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n21-20020aa7c695000000b0043d356d8672si5782794edq.133.2022.08.01.04.35.31; Mon, 01 Aug 2022 04:35:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231144AbiHALe0 (ORCPT + 65 others); Mon, 1 Aug 2022 07:34:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229935AbiHALeY (ORCPT ); Mon, 1 Aug 2022 07:34:24 -0400 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 91D7131935 for ; Mon, 1 Aug 2022 04:34:21 -0700 (PDT) Authenticated-By: X-SpamFilter-By: ArmorX SpamTrap 5.77 with qID 271BY5AE0012166, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36505.realtek.com.tw[172.21.6.25]) by rtits2.realtek.com.tw (8.15.2/2.81/5.90) with ESMTPS id 271BY5AE0012166 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=FAIL); Mon, 1 Aug 2022 19:34:05 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXH36505.realtek.com.tw (172.21.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Mon, 1 Aug 2022 19:34:13 +0800 Received: from localhost (172.16.16.191) by RTEXMBS04.realtek.com.tw (172.21.6.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Mon, 1 Aug 2022 19:34:13 +0800 From: Ping-Ke Shih To: CC: Subject: [PATCH v3] wifi: rtlwifi: 8192de: correct checking of IQK reload Date: Mon, 1 Aug 2022 19:33:45 +0800 Message-ID: <20220801113345.42016-1-pkshih@realtek.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [172.16.16.191] X-ClientProxiedBy: RTEXMBS02.realtek.com.tw (172.21.6.95) To RTEXMBS04.realtek.com.tw (172.21.6.97) X-KSE-ServerInfo: RTEXMBS04.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: trusted connection X-KSE-Antiphishing-Info: Clean X-KSE-Antiphishing-ScanningType: Deterministic X-KSE-Antiphishing-Method: None X-KSE-Antiphishing-Bases: 08/01/2022 11:19:00 X-KSE-AttachmentFiltering-Interceptor-Info: no applicable attachment filtering rules found X-KSE-Antivirus-Interceptor-Info: scan successful X-KSE-Antivirus-Info: =?big5?B?Q2xlYW4sIGJhc2VzOiAyMDIyLzgvMSCkV6TIIDA5OjQwOjAw?= X-KSE-BulkMessagesFiltering-Scan-Result: protection disabled X-KSE-ServerInfo: RTEXH36505.realtek.com.tw, 9 X-KSE-Attachment-Filter-Triggered-Rules: Clean X-KSE-Attachment-Filter-Triggered-Filters: Clean X-KSE-BulkMessagesFiltering-Scan-Result: protection disabled X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Since IQK could spend time, we make a cache of IQK result matrix that looks like iqk_matrix[channel_idx].val[x][y], and we can reload the matrix if we have made a cache. To determine a cache is made, we check iqk_matrix[channel_idx].val[0][0]. The initial commit 7274a8c22980 ("rtlwifi: rtl8192de: Merge phy routines") make a mistake that checks incorrect iqk_matrix[channel_idx].val[0] that is always true, and this mistake is found by commit ee3db469dd31 ("wifi: rtlwifi: remove always-true condition pointed out by GCC 12"), so I recall the vendor driver to find fix and apply the correctness. Fixes: 7274a8c22980 ("rtlwifi: rtl8192de: Merge phy routines") Signed-off-by: Ping-Ke Shih --- v3: add "wifi:" title prefix v2: add more commit message to make it clear what this patch does --- drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c index 15e6a6aded319..d18c092b61426 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c @@ -2386,11 +2386,10 @@ void rtl92d_phy_reload_iqk_setting(struct ieee80211_hw *hw, u8 channel) rtl_dbg(rtlpriv, COMP_SCAN, DBG_LOUD, "Just Read IQK Matrix reg for channel:%d....\n", channel); - _rtl92d_phy_patha_fill_iqk_matrix(hw, true, - rtlphy->iqk_matrix[ - indexforchannel].value, 0, - (rtlphy->iqk_matrix[ - indexforchannel].value[0][2] == 0)); + if (rtlphy->iqk_matrix[indexforchannel].value[0][0] != 0) + _rtl92d_phy_patha_fill_iqk_matrix(hw, true, + rtlphy->iqk_matrix[indexforchannel].value, 0, + rtlphy->iqk_matrix[indexforchannel].value[0][2] == 0); if (IS_92D_SINGLEPHY(rtlhal->version)) { if ((rtlphy->iqk_matrix[ indexforchannel].value[0][4] != 0) -- 2.25.1