Re: [PATCH 4/7] PCI/net: Use PCI_STD_NUM_BARS in loops instead of PCI_STD_RESOURCE_END
From: Bjorn Helgaas <helgaas@kernel.org>
Date: 2019-08-12 20:02:14
Also in:
linux-pci, lkml
The subject can be simply: <prefix>: Loop using PCI_STD_NUM_BARS to keep them a little shorter so "git log --online" doesn't wrap. On Sun, Aug 11, 2019 at 06:08:00PM +0300, Denis Efremov wrote:
This patch refactors the loop condition scheme from 'i <= PCI_STD_RESOURCE_END' to 'i < PCI_STD_NUM_BARS'.
Refactor loops to use 'i < PCI_STD_NUM_BARS' instead of 'i <= PCI_STD_RESOURCE_END'. See https://chris.beams.io/posts/git-commit/
Signed-off-by: Denis Efremov <efremov@linux.com> --- drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 4 ++-- drivers/net/ethernet/synopsys/dwc-xlgmac-pci.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
This patch touches two unrelated drivers and should be split up. When you do that, pay attention to the convention for commit log prefixes, e.g., $ git log --oneline drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c 37e9c087c814 stmmac: pci: Fix typo in IOT2000 comment d4a62ea411f9 stmmac: pci: Use pci_dev_id() helper e0c1d14a1a32 stmmac: pci: Adjust IOT2000 matching $ git log --oneline drivers/net/ethernet/synopsys/dwc-xlgmac-pci.c ea8c1c642ea5 net: dwc-xlgmac: declaration of dual license in headers 65e0ace2c5cd net: dwc-xlgmac: Initial driver for DesignWare Enterprise Ethernet
quoted hunk ↗ jump to hunk
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c index 86f9c07a38cf..cfe496cdd78b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c@@ -258,7 +258,7 @@ static int stmmac_pci_probe(struct pci_dev *pdev, } /* Get the base address of device */ - for (i = 0; i <= PCI_STD_RESOURCE_END; i++) { + for (i = 0; i < PCI_STD_NUM_BARS; i++) { if (pci_resource_len(pdev, i) == 0) continue; ret = pcim_iomap_regions(pdev, BIT(i), pci_name(pdev));@@ -296,7 +296,7 @@ static void stmmac_pci_remove(struct pci_dev *pdev) stmmac_dvr_remove(&pdev->dev); - for (i = 0; i <= PCI_STD_RESOURCE_END; i++) { + for (i = 0; i < PCI_STD_NUM_BARS; i++) { if (pci_resource_len(pdev, i) == 0) continue; pcim_iounmap_regions(pdev, BIT(i));diff --git a/drivers/net/ethernet/synopsys/dwc-xlgmac-pci.c b/drivers/net/ethernet/synopsys/dwc-xlgmac-pci.c index 386bafe74c3f..fa8604d7b797 100644 --- a/drivers/net/ethernet/synopsys/dwc-xlgmac-pci.c +++ b/drivers/net/ethernet/synopsys/dwc-xlgmac-pci.c@@ -34,7 +34,7 @@ static int xlgmac_probe(struct pci_dev *pcidev, const struct pci_device_id *id) return ret; } - for (i = 0; i <= PCI_STD_RESOURCE_END; i++) { + for (i = 0; i < PCI_STD_NUM_BARS; i++) { if (pci_resource_len(pcidev, i) == 0) continue; ret = pcim_iomap_regions(pcidev, BIT(i), XLGMAC_DRV_NAME);-- 2.21.0