Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2131339pxb; Sun, 31 Oct 2021 08:26:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDHq9Xd0PawSj2RGVoTzcDXK4R+8j03u0TmJCFyiKXz6k9P8yWmE0vM76trYUECCDF3Jo4 X-Received: by 2002:a05:6602:2d0a:: with SMTP id c10mr3591840iow.186.1635693960703; Sun, 31 Oct 2021 08:26:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635693960; cv=none; d=google.com; s=arc-20160816; b=pA0pFjtjt/AYHQ0P3e0HLGcngXdZDlnCURcAL1UNYWloaHPesVcLQzf03UbkOOEhgL yIetCEsaUdiZzmWuOwk8rain30Z/x0VNmRWwckyib7+TJj/asanVXbi/HKMlz6h02hXV 6q6pV2auTk8THfL/Op8xU/uuIvsnRNKGi2BfmCsI9TR9o/67E1faUvemaAeIz96p+MdE 28Eoy0gz1CqvXs4V6BaWMxEAJSw3mphOPI+XtyG7qtGd9kvz+Hytiv8qe2CsG+4zftM7 YcD4TwDE7SciLJjcjQRpW5TR+D1h8gn5BC3iGNkxtLZ4N09aOPu5mltOdgMTcKDV6Uee SFwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=21pEljWHVkJKFCf2QnU/C0q5jsw1Tl8OTDRkLuhbugA=; b=nNxrAilun4m0ExY6zH8g69iminvZ4PAMIq6Rubl6jRr/DBHzG1DoYiAFlrFjTZCyVK dVCvEURmKibz0t8IFxEeq22IaQXhdcOE8Z3zpsGEHOO9+EFItru950uxuWZEy6v2rySZ TdJ4CU+KPIT96npmtfG8ziQ+IDQ7kjm/j6rwf4QZE4TCZy4WFR1ewfPLoCcSSB/e9OBZ SkSg//dEftNk2Bb3GRnjaVK4+VkV71UFEqNPCzHXXEhjDtMQCOrIZelJ1oXJagdtmUcD 3a5Fa7KhpzNyA7sk1MTdX3Gb6mJjOPMfufou7Snqy6l5r/3KT1/pKapWGILy6bdBXMsz GZFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=pU0ZsPve; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i29si5851855ila.126.2021.10.31.08.25.49; Sun, 31 Oct 2021 08:26:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=pU0ZsPve; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229939AbhJaP1M (ORCPT + 99 others); Sun, 31 Oct 2021 11:27:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229936AbhJaP1K (ORCPT ); Sun, 31 Oct 2021 11:27:10 -0400 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17FB7C061570 for ; Sun, 31 Oct 2021 08:24:39 -0700 (PDT) Received: by mail-pg1-x533.google.com with SMTP id t7so14878722pgl.9 for ; Sun, 31 Oct 2021 08:24:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=21pEljWHVkJKFCf2QnU/C0q5jsw1Tl8OTDRkLuhbugA=; b=pU0ZsPveSrl+pcbTIyJNbIHeSKtk214VUCSu1lEsHwfTBbMHrCPd3pSmjIEAJPUmEI I8F9DjkteHmk6M+KqJZP2zToRv7Rbh9RTlMoHl+sud/aVrP+QUHxTBtgRgwqcqVXKFJ6 91cgBao1ZFYB/1Fd8IN+PYB5QRnuc5hMd+S6MhxkTLLyEpEte8xL/BBHiPtVBtw7pHhv FPpY67wO3kRvxfaZX7xQOH3tvmNrCEDX1LhQnaPOJod4hdrIgdI2wASg43C44/lZOtn7 eEhyRvnWvAOvh1hIA+p1Y6CY6lPblIr5x/uXopqKTRibRi7gYJtvS30y8V6byZNMPreq em8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=21pEljWHVkJKFCf2QnU/C0q5jsw1Tl8OTDRkLuhbugA=; b=jXc12uOXguhY3JFLeLMPt8kB2SFDffEYbfJhKjFAswLrLRj05iWraPQC8REJ0lp+Hl vJY33oJJH3rwdCBkbNhA9ebqSwxddkAkQp5hKpFzX27S9KKa5Cuv4Wz/typcRiZoEbHI AcazVJud4U8dnrpvasf/0pXWeW5fWqC8igUKOs32gkyVscvLOOcZsVZIUgibCqA0xuHn 1YNzlwSCIiaVmQZ8Nj4xdij4ivEnDvyqFnnnYTEEsaHSG8k3KCP0ZFV82S491DeMCRKA rbEYqheQdd9imC3LSgKrxeO6Nz/A4YhVXwyf6jJ87SM9r0zA25+H4HPAZboKs6tUrIjk pJvQ== X-Gm-Message-State: AOAM530reBvAAmJDth8G0bGdCjkCQKKqXCVmRtFLV29AIAWVudYBFi9T 4UtuE/CXgpBOfCpuhBjwgy4= X-Received: by 2002:a63:7c4f:: with SMTP id l15mr17775547pgn.19.1635693878488; Sun, 31 Oct 2021 08:24:38 -0700 (PDT) Received: from Sauravs-MacBook-Air.local ([59.95.84.6]) by smtp.gmail.com with ESMTPSA id 11sm12334597pfl.41.2021.10.31.08.24.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Oct 2021 08:24:36 -0700 (PDT) Date: Sun, 31 Oct 2021 20:54:26 +0530 From: Saurav Girepunje To: Larry.Finger@lwfinger.net, florian.c.schilhabel@googlemail.com, gregkh@linuxfoundation.org, saurav.girepunje@gmail.com, alec@vc-celle.de, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: saurav.girepunje@hotmail.com Subject: [PATCH v2] staging: rtl8712: remove the condition with no effect Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove the if condition check and else code section in query_rx_phy_status(). As variable cck_highpwr is assign a value of '0' after this assignment, if condition check !cck_highpwr is always going to be true. So remove the if condition check as well as else section which will be never true. After removing the if condition, There is no use of local variable cck_highpwr. Remove the local variable cck_highpwr. Merge the two lines as length of lines together is coming within limit of 80 columns. As per Linux kernel coding style. Signed-off-by: Saurav Girepunje --- Changelog V2: Merge the two lines as length of lines together is coming within limit of 80 columns. As per Linux kernel coding style. Changelog V1: Remove the if condition check and else code section in query_rx_phy_status(). As variable cck_highpwr is assign a value of '0' after this assignment, if condition check !cck_highpwr is always going to be true. So remove the if condition check as well as else section which will be never true. After removing the if condition there is no use of local variable cck_highpwr. Remove the local variable cck_highpwr. drivers/staging/rtl8712/rtl8712_recv.c | 71 ++++++++------------------ 1 file changed, 22 insertions(+), 49 deletions(-) diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c index 0ffb30f1af7e..1c00905b4799 100644 --- a/drivers/staging/rtl8712/rtl8712_recv.c +++ b/drivers/staging/rtl8712/rtl8712_recv.c @@ -708,7 +708,7 @@ static void query_rx_phy_status(struct _adapter *padapter, s8 rx_pwr[4], rx_pwr_all; u8 pwdb_all; u32 rssi, total_rssi = 0; - u8 bcck_rate = 0, rf_rx_num = 0, cck_highpwr = 0; + u8 bcck_rate = 0, rf_rx_num = 0; struct phy_cck_rx_status *pcck_buf; u8 sq; @@ -723,55 +723,28 @@ static void query_rx_phy_status(struct _adapter *padapter, * (2)PWDB, Average PWDB calculated by hardware * (for rate adaptive) */ - if (!cck_highpwr) { - report = pcck_buf->cck_agc_rpt & 0xc0; - report >>= 6; - switch (report) { - /* Modify the RF RNA gain value to -40, -20, - * -2, 14 by Jenyu's suggestion - * Note: different RF with the different - * RNA gain. - */ - case 0x3: - rx_pwr_all = -40 - (pcck_buf->cck_agc_rpt & - 0x3e); - break; - case 0x2: - rx_pwr_all = -20 - (pcck_buf->cck_agc_rpt & - 0x3e); - break; - case 0x1: - rx_pwr_all = -2 - (pcck_buf->cck_agc_rpt & - 0x3e); - break; - case 0x0: - rx_pwr_all = 14 - (pcck_buf->cck_agc_rpt & - 0x3e); - break; - } - } else { - report = ((u8)(le32_to_cpu(pphy_stat->phydw1) >> 8)) & - 0x60; - report >>= 5; - switch (report) { - case 0x3: - rx_pwr_all = -40 - ((pcck_buf->cck_agc_rpt & - 0x1f) << 1); - break; - case 0x2: - rx_pwr_all = -20 - ((pcck_buf->cck_agc_rpt & - 0x1f) << 1); - break; - case 0x1: - rx_pwr_all = -2 - ((pcck_buf->cck_agc_rpt & - 0x1f) << 1); - break; - case 0x0: - rx_pwr_all = 14 - ((pcck_buf->cck_agc_rpt & - 0x1f) << 1); - break; - } + report = pcck_buf->cck_agc_rpt & 0xc0; + report >>= 6; + switch (report) { + /* Modify the RF RNA gain value to -40, -20, + * -2, 14 by Jenyu's suggestion + * Note: different RF with the different + * RNA gain. + */ + case 0x3: + rx_pwr_all = -40 - (pcck_buf->cck_agc_rpt & 0x3e); + break; + case 0x2: + rx_pwr_all = -20 - (pcck_buf->cck_agc_rpt & 0x3e); + break; + case 0x1: + rx_pwr_all = -2 - (pcck_buf->cck_agc_rpt & 0x3e); + break; + case 0x0: + rx_pwr_all = 14 - (pcck_buf->cck_agc_rpt & 0x3e); + break; } + pwdb_all = query_rx_pwr_percentage(rx_pwr_all); /* CCK gain is smaller than OFDM/MCS gain,*/ /* so we add gain diff by experiences, the val is 6 */ -- 2.33.0