Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp1889599rdf; Sun, 5 Nov 2023 19:45:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IHA8WviXWKKHYlC9Q2MAIo0ZLCVdMjODrj4ZZwzE4BdABUuRs6zn2/zjYkPJ1O+yz0TFmFi X-Received: by 2002:a05:6808:2386:b0:3b5:ae0d:b1f5 with SMTP id bp6-20020a056808238600b003b5ae0db1f5mr485279oib.50.1699242310771; Sun, 05 Nov 2023 19:45:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699242310; cv=none; d=google.com; s=arc-20160816; b=Of99q4E6LT3QKTrbtI+9oBdwqXpDTvK7btQoV64GKiXHvXyh1UuUqvj7RAudrhjQhk PEBG4Nk3y8Oe+d+Jnl7U40gFgM9xclmyDk9BPHVTX3b9OKuqwww/GX1vb52BDRLHe8rg u7jf7wLW3qGzEVSFup5l+7Bemtl5yAH6QujtxGX938gfxAQuxIWgZqaJpg+GQ3GEdAzt +naSTVWREuNn8Gnm905HyonEWOkA7Ip98vsVdQGE/JDAjWo6ndfkfAJgXkLUrgvfN7uS y5I9nNQIGvj4Kr1qlpjxBFXtFYc8bvmifWiQyGboZzajEWX8hUwlBEL+k48qkPjb8ZNj H9Pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=TUEPVq/ukRCBMcsY8jGRZlLieY8BF+VdbtFtLju/40k=; fh=2hI485HFlXJy+4lLjgPX5/GYVcxclaS/2eVblZtiuKQ=; b=syuJe8rzKbjZM6r8PnPM4ql7I5XTLUeJ2pVulQVzkUHSmqZyqs6u260+Zdj41QgfYm CDr+La9JLlmefhP19MraZgkooda+yQ25t3jRbuvQj7wWL8F7LJ+5PrVZgL0w5UmiC4Rg sJ0T87ZDgQR67JXXfULqd1IwGbiJlHo+yoNe38xmAliZ3CFy7KxX3lh4nG8wKQHwp8Vp xwtXVlMZX/peMQ6aYtA7hhJQe5fEPwS4VyERxGJG9o2xgPyyXlZSYpz0e3+VCK1a733v uzl2qeEN5xkqzskYUN8wWtdNxpHmL0FqSXhFHTLqbM4u7lSMcvenFR+fGsEgx4wM/lAd GN2g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id bd32-20020a056a0027a000b006c34cacf9bfsi7153441pfb.284.2023.11.05.19.45.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Nov 2023 19:45:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 82F2080AC5BF; Sun, 5 Nov 2023 19:45:05 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230215AbjKFDpE convert rfc822-to-8bit (ORCPT + 55 others); Sun, 5 Nov 2023 22:45:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230145AbjKFDpD (ORCPT ); Sun, 5 Nov 2023 22:45:03 -0500 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6BFFF9 for ; Sun, 5 Nov 2023 19:45:00 -0800 (PST) X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 3A63iooY73228188, 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.95/5.92) with ESMTPS id 3A63iooY73228188 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 6 Nov 2023 11:44:50 +0800 Received: from RTEXMBS02.realtek.com.tw (172.21.6.95) 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.32; Mon, 6 Nov 2023 11:44:50 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXMBS02.realtek.com.tw (172.21.6.95) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Mon, 6 Nov 2023 11:44:50 +0800 Received: from RTEXMBS04.realtek.com.tw ([fe80::40c2:6c24:2df4:e6c7]) by RTEXMBS04.realtek.com.tw ([fe80::40c2:6c24:2df4:e6c7%5]) with mapi id 15.01.2375.007; Mon, 6 Nov 2023 11:44:50 +0800 From: Ping-Ke Shih To: Dmitry Antipov CC: Kalle Valo , "linux-wireless@vger.kernel.org" , "lvc-project@linuxtesting.org" Subject: RE: [PATCH 2/2] wifi: rtlwifi: simplify _rtl8812ae_phy_get_txpower_limit() Thread-Topic: [PATCH 2/2] wifi: rtlwifi: simplify _rtl8812ae_phy_get_txpower_limit() Thread-Index: AQHaDLfhFsCt0hys00yQX+j8v0xH3rBsq7dQ Date: Mon, 6 Nov 2023 03:44:50 +0000 Message-ID: <1c93129fac184534901eca45b563cf44@realtek.com> References: <20231101113510.51290-1-dmantipov@yandex.ru> <20231101113510.51290-2-dmantipov@yandex.ru> In-Reply-To: <20231101113510.51290-2-dmantipov@yandex.ru> Accept-Language: en-US, zh-TW Content-Language: zh-TW x-originating-ip: [172.21.69.94] x-kse-serverinfo: RTEXMBS02.realtek.com.tw, 9 x-kse-antivirus-attachment-filter-interceptor-info: license violation Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-KSE-ServerInfo: RTEXH36505.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Sun, 05 Nov 2023 19:45:05 -0800 (PST) > -----Original Message----- > From: Dmitry Antipov > Sent: Wednesday, November 1, 2023 7:35 PM > To: Ping-Ke Shih > Cc: Kalle Valo ; linux-wireless@vger.kernel.org; lvc-project@linuxtesting.org; Dmitry > Antipov > Subject: [PATCH 2/2] wifi: rtlwifi: simplify _rtl8812ae_phy_get_txpower_limit() > > Since 'regulation' is a compile-time constant equal to > 'TXPWR_LMT_WW', mark it as such and simplify few branches > in '_rtl8812ae_phy_get_txpower_limit()'. Compile tested only. > > Found by Linux Verification Center (linuxtesting.org) with SVACE. > > Signed-off-by: Dmitry Antipov > --- > .../wireless/realtek/rtlwifi/rtl8821ae/phy.c | 24 +++++++------------ > 1 file changed, 8 insertions(+), 16 deletions(-) > > diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c > b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c > index c262770fea29..27e256a82f00 100644 [...] > @@ -2415,10 +2413,7 @@ static s8 _rtl8812ae_phy_get_txpower_limit(struct ieee80211_hw *hw, > limits[i] = rtlphy->txpwr_limit_2_4g[i][bdwidth] > [sec][chnl][rf_path]; > > - power_limit = (regulation == TXPWR_LMT_WW) ? > - _rtl8812ae_phy_get_world_wide_limit(limits) : > - rtlphy->txpwr_limit_2_4g[regu][bdwidth] > - [sec][chnl][rf_path]; > + power_limit = _rtl8812ae_phy_get_world_wide_limit(limits); I think the constantly selection of "WW" is just a workaround, and correct way is to add regd notifier and handle regulatory request. Ping-Ke