Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp1501924lqb; Sun, 26 May 2024 04:21:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXck8q0lDyzdExDVEx4IkwMZfkG/2inhWRU7aZL3tj9VD3OX9vyuz6xqk9P8Rfl3QR4WaexMdrfMwG1L1j4Tzz0s+gaXVF6xj13oCNu/w== X-Google-Smtp-Source: AGHT+IFjA0dlbKXT1AC96rvJvbbkkE6kCGiZDwvlC58wOtkUgJUTvKlrlydrWQ0Qi02KYDZtm/Jr X-Received: by 2002:a17:90b:4a44:b0:2b9:d6cd:ff63 with SMTP id 98e67ed59e1d1-2bf5e473948mr5228590a91.8.1716722462846; Sun, 26 May 2024 04:21:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716722462; cv=pass; d=google.com; s=arc-20160816; b=shqMMfVxNVzqG4yOFIWiyneIIXKEUSimYv+2nge6KcRNGGtrC3rFxhVHMV8o0lpizO KDrCHyQ5QUoonxRt+34L5yqh87WbiJA1epouEYKtBLOT/VWfePItJ6rJmpiyvQAca6bk GtRev5w10z/1BGoVuZY8wSlV2dGFI8KcrrR1dwZ1GWRQjFKNMwe8OSHaN8eQKZGzK5kL 3i1m2W/JO8g6v92BE4cTP1KZfumA8q1MVsm7YuEf+615zolPpza08vmaI2BKAA63YjgY yjH40gZ/dExn1xKhqCZbV1YtA1WlodVoBFf+I28xGzPrXwQlH2w0qzHPJIpA5eMQ9/hs tSdg== ARC-Message-Signature: i=2; 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=syZ0Cd4s3FznpGYw+gPuAARyriAcDeWsVaK2kx6TUGw=; fh=EdEqwlBhssQBKyM+mWGvjhMCfX6hYDzmXFPME2YH0tE=; b=VlZWA0Y9dHW/xbI7VuS6jBlBYcSuLvG32dcIwUxp7lyrDiyji1d09LzkbAJHA9nxHD mnqHyTHJ9HW9C5lPPmzyjLuZove2TCBqfQuVP9R6i2u5VVHVtH8axp9p7ymKvIuOhahK ye40OCqqSCtbuYYQbtTN2kGNHL9Cxa/YYcULuAFMfWWM+kj/puarS4MmylDT9E6eAbAQ Ku4VToxU5+3TLUdp5GCT6Sz/zS/foIeyN1on6tl7z454dUBc3Ca/E4N2wEKT1CdVe+ls SYQlSTxl+ec0M/qclcEXffHLtvFjXAt9uMgoaGYPiE5zS6BYMfLa/bfhp+zA2zzNe7xu vuzg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=GS7D0xIS; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-189721-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189721-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2bf5fac6475si4411553a91.26.2024.05.26.04.21.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 May 2024 04:21:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-189721-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=GS7D0xIS; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-189721-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189721-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 0B3482812C7 for ; Sun, 26 May 2024 11:21:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 970E8E55F; Sun, 26 May 2024 11:20:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GS7D0xIS" Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BB0832905 for ; Sun, 26 May 2024 11:20:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716722447; cv=none; b=jiV05ZFi826JYWwi9kb4Kc9xcS3a/Bwf/jwsdiHGiTTtI6GhC9PNkd44YEVik0xZxj15i4XOPNs1O/Bvsq2LfdCQNUA9AYgh954DNQKSiirRkzVMn99V4B3YaXudMJUVVee+UB8PApieW9eaqDE6tGx/z4Aefn0fr1a0tNBIZUA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716722447; c=relaxed/simple; bh=4nW91lsMoRhISbgOyFITvMo+Qsc6DiQN/rZt8bOa+/E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jdW/HeO8QNmc6NdiG9LVBY42KzcCzXjspx8QI6gZ54HBWRvQFV91ZSR1KdGwh+58X14ws8n1RvnDonwLGkeIEfex1j3ykJJmS/wG7iatXeR+wYvmt3TyZve1IViBFJiT9o8BgDlkB/Jyuq7ZzAuNm99QqPt4W6w8695PvKkFeCg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=GS7D0xIS; arc=none smtp.client-ip=209.85.218.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-a6265d48ec3so246504266b.0 for ; Sun, 26 May 2024 04:20:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716722444; x=1717327244; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=syZ0Cd4s3FznpGYw+gPuAARyriAcDeWsVaK2kx6TUGw=; b=GS7D0xIS36srUq/KYHzcZI70KqoRg1RP3035hHm/lsIAgD1sP7Db7TZvhVndc+5vjd 5Uwsy8uUTYT3EolfU6a1ypCJNAK1EXP3va0kgzQz8eqeiX3i/B8RdJ5AS6/7ar3uYR6I GV/2lYPNh8JUa1s5L9eAQ72ITftjOJsrEMOnfdVqBqmpSVHFjBI1onehjMoxnD+vPvAR eYHL9PZgRdUtnXmm7ey6NdHt1iBKdVqnu00Kx6rXh2ZK1ExhJ9IByXMwcMyz1CUFem9L 1vGRBft31OmgzGltdO8/axJ+uzCX5YTHM7Z0Ah1Qi5MORQ73IhimtVQG283rBbAH10nT bTUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716722444; x=1717327244; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=syZ0Cd4s3FznpGYw+gPuAARyriAcDeWsVaK2kx6TUGw=; b=Qk1xPrBtmDHFACLBX8MDaX9Rjl1dkm6n0crbItvcgNQhP5t/WAswcxQ6uZXrCBvflg ciw9vbLZbj3wkR3wF2Ek9kkHbJFCbfnAnL8JtYWmun9DiCWG5qR0C0YbsMU5FAc/zCMQ zQFTAjsSBHo0ExlAcE0WGYFFCXjUPgYHlCGPOS3hsuaAYcly1y3yBuBPUmCksynl7kxK w443z2o9opAkCQw8D9+KbpH9GZDgeg7VHD7/htbB5s4kGWshar926X/axlQZ+bXu9YNM mPnI55nI/GrUrM+CGlecnYlMWes3N9kZH3QMHGBfVH2WKx8HWG/Gk6OhT8ypbVdx1/Xz yJlg== X-Forwarded-Encrypted: i=1; AJvYcCWTwVtig2zd1iDJzf1JB50MjoEgwepAWXJbVb9cHWKbPp3Qy51txb3BlzwOKvO9AvGuj9oFkOFolzMtAybW/U/jpzzvp2RiWAtyBoj9 X-Gm-Message-State: AOJu0YxFUZ1DynWm+ySmlTOz5Wm30A38HLTi+ZJYZ4ETUUhBCiOjCGL+ 2XUPDojR2ytCQ/y/rTJ69By+zvDK0VhstfKXbN+NT+enhGZuPwve X-Received: by 2002:a17:906:c217:b0:a62:2ef9:139 with SMTP id a640c23a62f3a-a6262f5c244mr441785666b.0.1716722444087; Sun, 26 May 2024 04:20:44 -0700 (PDT) Received: from localhost.localdomain (ip-77-25-34-87.web.vodafone.de. [77.25.34.87]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cc8e534sm373983366b.170.2024.05.26.04.20.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 May 2024 04:20:43 -0700 (PDT) From: Michael Straube To: gregkh@linuxfoundation.org Cc: philipp.g.hortmann@gmail.com, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Michael Straube Subject: [PATCH 1/3] staging: rtl8192e: reduce indentation level Date: Sun, 26 May 2024 13:19:26 +0200 Message-ID: <20240526111928.14574-2-straube.linux@gmail.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240526111928.14574-1-straube.linux@gmail.com> References: <20240526111928.14574-1-straube.linux@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Reduce indentation level in _rtl92e_dm_rx_path_sel_byrssi() by negating if statements and use continue in for loops. This way the indentation level of the code that is covered by the if checks can be reduced. This improves readability and clears two checkpatch warnings. WARNING: Too many leading tabs - consider code refactoring Signed-off-by: Michael Straube --- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 170 +++++++++++---------- 1 file changed, 86 insertions(+), 84 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index aebe67f1a46d..2fda44c5a412 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -1335,51 +1335,52 @@ static void _rtl92e_dm_rx_path_sel_byrssi(struct net_device *dev) for (i = 0; i < RF90_PATH_MAX; i++) { dm_rx_path_sel_table.rf_rssi[i] = priv->stats.rx_rssi_percentage[i]; - if (priv->brfpath_rxenable[i]) { - rf_num++; - cur_rf_rssi = dm_rx_path_sel_table.rf_rssi[i]; - - if (rf_num == 1) { - max_rssi_index = min_rssi_index = sec_rssi_index = i; - tmp_max_rssi = tmp_min_rssi = tmp_sec_rssi = cur_rf_rssi; - } else if (rf_num == 2) { - if (cur_rf_rssi >= tmp_max_rssi) { - tmp_max_rssi = cur_rf_rssi; - max_rssi_index = i; - } else { - tmp_sec_rssi = tmp_min_rssi = cur_rf_rssi; - sec_rssi_index = min_rssi_index = i; - } + if (!priv->brfpath_rxenable[i]) + continue; + + rf_num++; + cur_rf_rssi = dm_rx_path_sel_table.rf_rssi[i]; + + if (rf_num == 1) { + max_rssi_index = min_rssi_index = sec_rssi_index = i; + tmp_max_rssi = tmp_min_rssi = tmp_sec_rssi = cur_rf_rssi; + } else if (rf_num == 2) { + if (cur_rf_rssi >= tmp_max_rssi) { + tmp_max_rssi = cur_rf_rssi; + max_rssi_index = i; } else { - if (cur_rf_rssi > tmp_max_rssi) { - tmp_sec_rssi = tmp_max_rssi; - sec_rssi_index = max_rssi_index; - tmp_max_rssi = cur_rf_rssi; - max_rssi_index = i; - } else if (cur_rf_rssi == tmp_max_rssi) { - tmp_sec_rssi = cur_rf_rssi; - sec_rssi_index = i; - } else if ((cur_rf_rssi < tmp_max_rssi) && - (cur_rf_rssi > tmp_sec_rssi)) { + tmp_sec_rssi = tmp_min_rssi = cur_rf_rssi; + sec_rssi_index = min_rssi_index = i; + } + } else { + if (cur_rf_rssi > tmp_max_rssi) { + tmp_sec_rssi = tmp_max_rssi; + sec_rssi_index = max_rssi_index; + tmp_max_rssi = cur_rf_rssi; + max_rssi_index = i; + } else if (cur_rf_rssi == tmp_max_rssi) { + tmp_sec_rssi = cur_rf_rssi; + sec_rssi_index = i; + } else if ((cur_rf_rssi < tmp_max_rssi) && + (cur_rf_rssi > tmp_sec_rssi)) { + tmp_sec_rssi = cur_rf_rssi; + sec_rssi_index = i; + } else if (cur_rf_rssi == tmp_sec_rssi) { + if (tmp_sec_rssi == tmp_min_rssi) { tmp_sec_rssi = cur_rf_rssi; sec_rssi_index = i; - } else if (cur_rf_rssi == tmp_sec_rssi) { - if (tmp_sec_rssi == tmp_min_rssi) { - tmp_sec_rssi = cur_rf_rssi; - sec_rssi_index = i; - } - } else if ((cur_rf_rssi < tmp_sec_rssi) && - (cur_rf_rssi > tmp_min_rssi)) { - ; - } else if (cur_rf_rssi == tmp_min_rssi) { - if (tmp_sec_rssi == tmp_min_rssi) { - tmp_min_rssi = cur_rf_rssi; - min_rssi_index = i; - } - } else if (cur_rf_rssi < tmp_min_rssi) { + } + } else if ((cur_rf_rssi < tmp_sec_rssi) && + (cur_rf_rssi > tmp_min_rssi)) { + ; + } else if (cur_rf_rssi == tmp_min_rssi) { + if (tmp_sec_rssi == tmp_min_rssi) { tmp_min_rssi = cur_rf_rssi; min_rssi_index = i; } + } else if (cur_rf_rssi < tmp_min_rssi) { + tmp_min_rssi = cur_rf_rssi; + min_rssi_index = i; } } } @@ -1387,59 +1388,60 @@ static void _rtl92e_dm_rx_path_sel_byrssi(struct net_device *dev) rf_num = 0; if (dm_rx_path_sel_table.cck_method == CCK_Rx_Version_2) { for (i = 0; i < RF90_PATH_MAX; i++) { - if (priv->brfpath_rxenable[i]) { - rf_num++; - cur_cck_pwdb = - dm_rx_path_sel_table.cck_pwdb_sta[i]; + if (!priv->brfpath_rxenable[i]) + continue; - if (rf_num == 1) { + rf_num++; + cur_cck_pwdb = + dm_rx_path_sel_table.cck_pwdb_sta[i]; + + if (rf_num == 1) { + cck_rx_ver2_max_index = i; + cck_rx_ver2_sec_index = i; + tmp_cck_max_pwdb = cur_cck_pwdb; + tmp_cck_min_pwdb = cur_cck_pwdb; + tmp_cck_sec_pwdb = cur_cck_pwdb; + } else if (rf_num == 2) { + if (cur_cck_pwdb >= tmp_cck_max_pwdb) { + tmp_cck_max_pwdb = cur_cck_pwdb; cck_rx_ver2_max_index = i; + } else { + tmp_cck_sec_pwdb = cur_cck_pwdb; + tmp_cck_min_pwdb = cur_cck_pwdb; cck_rx_ver2_sec_index = i; + } + } else { + if (cur_cck_pwdb > tmp_cck_max_pwdb) { + tmp_cck_sec_pwdb = + tmp_cck_max_pwdb; + cck_rx_ver2_sec_index = + cck_rx_ver2_max_index; tmp_cck_max_pwdb = cur_cck_pwdb; - tmp_cck_min_pwdb = cur_cck_pwdb; + cck_rx_ver2_max_index = i; + } else if (cur_cck_pwdb == + tmp_cck_max_pwdb) { tmp_cck_sec_pwdb = cur_cck_pwdb; - } else if (rf_num == 2) { - if (cur_cck_pwdb >= tmp_cck_max_pwdb) { - tmp_cck_max_pwdb = cur_cck_pwdb; - cck_rx_ver2_max_index = i; - } else { - tmp_cck_sec_pwdb = cur_cck_pwdb; - tmp_cck_min_pwdb = cur_cck_pwdb; - cck_rx_ver2_sec_index = i; - } - } else { - if (cur_cck_pwdb > tmp_cck_max_pwdb) { + cck_rx_ver2_sec_index = i; + } else if (PWDB_IN_RANGE) { + tmp_cck_sec_pwdb = cur_cck_pwdb; + cck_rx_ver2_sec_index = i; + } else if (cur_cck_pwdb == + tmp_cck_sec_pwdb) { + if (tmp_cck_sec_pwdb == + tmp_cck_min_pwdb) { tmp_cck_sec_pwdb = - tmp_cck_max_pwdb; + cur_cck_pwdb; cck_rx_ver2_sec_index = - cck_rx_ver2_max_index; - tmp_cck_max_pwdb = cur_cck_pwdb; - cck_rx_ver2_max_index = i; - } else if (cur_cck_pwdb == - tmp_cck_max_pwdb) { - tmp_cck_sec_pwdb = cur_cck_pwdb; - cck_rx_ver2_sec_index = i; - } else if (PWDB_IN_RANGE) { - tmp_cck_sec_pwdb = cur_cck_pwdb; - cck_rx_ver2_sec_index = i; - } else if (cur_cck_pwdb == - tmp_cck_sec_pwdb) { - if (tmp_cck_sec_pwdb == - tmp_cck_min_pwdb) { - tmp_cck_sec_pwdb = - cur_cck_pwdb; - cck_rx_ver2_sec_index = - i; - } - } else if ((cur_cck_pwdb < tmp_cck_sec_pwdb) && - (cur_cck_pwdb > tmp_cck_min_pwdb)) { - ; - } else if (cur_cck_pwdb == tmp_cck_min_pwdb) { - if (tmp_cck_sec_pwdb == tmp_cck_min_pwdb) - tmp_cck_min_pwdb = cur_cck_pwdb; - } else if (cur_cck_pwdb < tmp_cck_min_pwdb) { - tmp_cck_min_pwdb = cur_cck_pwdb; + i; } + } else if ((cur_cck_pwdb < tmp_cck_sec_pwdb) && + (cur_cck_pwdb > tmp_cck_min_pwdb)) { + ; + } else if (cur_cck_pwdb == tmp_cck_min_pwdb) { + if (tmp_cck_sec_pwdb == tmp_cck_min_pwdb) + tmp_cck_min_pwdb = cur_cck_pwdb; + } else if (cur_cck_pwdb < tmp_cck_min_pwdb) { + tmp_cck_min_pwdb = cur_cck_pwdb; } } } -- 2.45.1