Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp4614494ybe; Mon, 16 Sep 2019 15:31:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqweDKN2UdVnHb1eaoc7HcIjQwyCp+9pPgTuLx4EtrER9BURuCL+uQzMUTeyA5wcw2Q3VdGD X-Received: by 2002:a50:8ad1:: with SMTP id k17mr1616208edk.243.1568673113816; Mon, 16 Sep 2019 15:31:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568673113; cv=none; d=google.com; s=arc-20160816; b=zEHX1NBiaQ5vtnXQvGiMkSoDq+/TFvGFpRpuGUJTCGXvGWRK1A0NGfUWfe4YUmkeHR W/3+DaThcZAXAtRe06T0IwyT9Oz1sBOulRRlWwOtaGFDeqMFxyNrpbXELAuScLhZKOVB PLFwE3loSSwy2TeNc3VLLDDEhSkv4uf5tZybX++CxmU47Mf2cBqb6varzNswBCeLhC1d xvMtZ0Q1h16+1UTluajdT7XuOhLXgyQefsHZGIjvJOcnAYayLOhos2N5P69hEy/SfEKN 6A0ewpOJ+ukg1KP0tOwDlyyBxjXOA+c4bleE3fcvJVgJc/caCniHX1UUnJtOsv0M1AaG ML9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=QR/S6ZclFf3ctqEohNgiNTP20YUhWH32oSyd8G++lVQ=; b=KmTs4xU9YJWQN91DKyTi7zfrwtKim5/dB5Sg+Po6YMjKI6MgSBe/fxq6hlMvcxUucm E0T17jdXWKYqxMTLArIvMyCxyJfRKusQwkCRZJt2U8kaZFn6IzonlyzdoR6qOnuazkiX SszCnVdk/1ExybYjfMWwTTBHgVLMAu/fk7PYUw7pFOPfqCGBB4wEJQqtiSyTHfT/3ubv r1mywj3FuyReiAZSnJiZZ99jqf+zFp8JLLnF3th0J58QkM2QcX/AcUz3rupaFbrumUT+ VYeIEYhNOWOkczYBo4WTq5Bju6AXep62SgvwquNXTOUK4Qyy+3yWqsH+Zo1MnfuOx4Oy C5zQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b24si141902eje.85.2019.09.16.15.31.29; Mon, 16 Sep 2019 15:31:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388254AbfIPUpa (ORCPT + 99 others); Mon, 16 Sep 2019 16:45:30 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:39807 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727851AbfIPUp3 (ORCPT ); Mon, 16 Sep 2019 16:45:29 -0400 Received: by mail-wm1-f68.google.com with SMTP id v17so693426wml.4; Mon, 16 Sep 2019 13:45:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QR/S6ZclFf3ctqEohNgiNTP20YUhWH32oSyd8G++lVQ=; b=f0YHPr6KR/5mTB4I6K26bDjwDoBUB5kWCbO2qAFmfBw4TEbjg/HCndFzzzBgVS0bya 3sfQwZ4KjngTafUtob1tIUuCuyM9RPlwZ8iVd37/ySr3CbIxsZZSJa4rRsKdF+Khtj0d NUKVZ1a3hjClT+bMxwsSdeUNGtuthNko8VcKU/LH0O8kzg6DVInUyPvgSMvNcFDQn0VW hniRQ/rzHQyl5Sff6HEliT0dvBSGJY5o4J+7xH6BwQzg/pP6vPMdPmB1k3f32jURYMOD zNW2tDWcq7wwaSyw3FDdfn01aMXhlbzs7WIFvsBvrDIMPSzTeV1sBqtGHuW1+RN+DoOy IMlQ== X-Gm-Message-State: APjAAAVGNBgxXmwKL/CRDnepNZ7PKO9Bv834SWadNhnBiGNk2bUbzOzp qjJK5NDNN3n5VuXNmnc/Wfc= X-Received: by 2002:a1c:bcd6:: with SMTP id m205mr627239wmf.129.1568666727659; Mon, 16 Sep 2019 13:45:27 -0700 (PDT) Received: from black.home (broadband-188-32-48-208.ip.moscow.rt.ru. [188.32.48.208]) by smtp.googlemail.com with ESMTPSA id x6sm231437wmf.38.2019.09.16.13.45.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2019 13:45:27 -0700 (PDT) From: Denis Efremov To: Bjorn Helgaas Cc: Denis Efremov , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Andrew Murray , netdev@vger.kernel.org, Jeff Kirsher , "David S. Miller" Subject: [PATCH v3 12/26] ixgb: use PCI_STD_NUM_BARS Date: Mon, 16 Sep 2019 23:41:44 +0300 Message-Id: <20190916204158.6889-13-efremov@linux.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190916204158.6889-1-efremov@linux.com> References: <20190916204158.6889-1-efremov@linux.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To iterate through all possible BARs, loop conditions refactored to the *number* of BARs "i < PCI_STD_NUM_BARS", instead of the index of the last valid BAR "i <= BAR_5". This is more idiomatic C style and allows to avoid the fencepost error. Cc: Jeff Kirsher Cc: "David S. Miller" Signed-off-by: Denis Efremov --- drivers/net/ethernet/intel/ixgb/ixgb.h | 1 - drivers/net/ethernet/intel/ixgb/ixgb_main.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgb/ixgb.h b/drivers/net/ethernet/intel/ixgb/ixgb.h index e85271b68410..681d44cc9784 100644 --- a/drivers/net/ethernet/intel/ixgb/ixgb.h +++ b/drivers/net/ethernet/intel/ixgb/ixgb.h @@ -42,7 +42,6 @@ #define BAR_0 0 #define BAR_1 1 -#define BAR_5 5 struct ixgb_adapter; #include "ixgb_hw.h" diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_main.c b/drivers/net/ethernet/intel/ixgb/ixgb_main.c index e5ac2d3fd816..c5bba18eb32a 100644 --- a/drivers/net/ethernet/intel/ixgb/ixgb_main.c +++ b/drivers/net/ethernet/intel/ixgb/ixgb_main.c @@ -412,7 +412,7 @@ ixgb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto err_ioremap; } - for (i = BAR_1; i <= BAR_5; i++) { + for (i = BAR_1; i < PCI_STD_NUM_BARS; i++) { if (pci_resource_len(pdev, i) == 0) continue; if (pci_resource_flags(pdev, i) & IORESOURCE_IO) { -- 2.21.0