linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Denis Efremov <efremov@linux.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: Denis Efremov <efremov@linux.com>,
	linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	Andrew Murray <andrew.murray@arm.com>
Subject: [PATCH v2 10/10] PCI: Use PCI_STD_NUM_BARS
Date: Fri, 16 Aug 2019 12:24:37 +0300	[thread overview]
Message-ID: <20190816092437.31846-11-efremov@linux.com> (raw)
In-Reply-To: <20190816092437.31846-1-efremov@linux.com>

Replace the magic constant with define PCI_STD_NUM_BARS.

Signed-off-by: Denis Efremov <efremov@linux.com>
---
 drivers/pci/pci.c    | 11 ++++++-----
 drivers/pci/quirks.c |  2 +-
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 1b27b5af3d55..a9005c9eee6c 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -3768,7 +3768,7 @@ void pci_release_selected_regions(struct pci_dev *pdev, int bars)
 {
 	int i;
 
-	for (i = 0; i < 6; i++)
+	for (i = 0; i < PCI_STD_NUM_BARS; i++)
 		if (bars & (1 << i))
 			pci_release_region(pdev, i);
 }
@@ -3779,7 +3779,7 @@ static int __pci_request_selected_regions(struct pci_dev *pdev, int bars,
 {
 	int i;
 
-	for (i = 0; i < 6; i++)
+	for (i = 0; i < PCI_STD_NUM_BARS; i++)
 		if (bars & (1 << i))
 			if (__pci_request_region(pdev, i, res_name, excl))
 				goto err_out;
@@ -3827,7 +3827,7 @@ EXPORT_SYMBOL(pci_request_selected_regions_exclusive);
 
 void pci_release_regions(struct pci_dev *pdev)
 {
-	pci_release_selected_regions(pdev, (1 << 6) - 1);
+	pci_release_selected_regions(pdev, (1 << PCI_STD_NUM_BARS) - 1);
 }
 EXPORT_SYMBOL(pci_release_regions);
 
@@ -3846,7 +3846,8 @@ EXPORT_SYMBOL(pci_release_regions);
  */
 int pci_request_regions(struct pci_dev *pdev, const char *res_name)
 {
-	return pci_request_selected_regions(pdev, ((1 << 6) - 1), res_name);
+	return pci_request_selected_regions(pdev,
+			((1 << PCI_STD_NUM_BARS) - 1), res_name);
 }
 EXPORT_SYMBOL(pci_request_regions);
 
@@ -3868,7 +3869,7 @@ EXPORT_SYMBOL(pci_request_regions);
 int pci_request_regions_exclusive(struct pci_dev *pdev, const char *res_name)
 {
 	return pci_request_selected_regions_exclusive(pdev,
-					((1 << 6) - 1), res_name);
+				((1 << PCI_STD_NUM_BARS) - 1), res_name);
 }
 EXPORT_SYMBOL(pci_request_regions_exclusive);
 
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 02bdf3a0231e..51caa61e6112 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1810,7 +1810,7 @@ static void quirk_alder_ioapic(struct pci_dev *pdev)
 	 * The next five BARs all seem to be rubbish, so just clean
 	 * them out.
 	 */
-	for (i = 1; i < 6; i++)
+	for (i = 1; i < PCI_STD_NUM_BARS; i++)
 		memset(&pdev->resource[i], 0, sizeof(pdev->resource[i]));
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL,	PCI_DEVICE_ID_INTEL_EESSC,	quirk_alder_ioapic);
-- 
2.21.0


  parent reply	other threads:[~2019-08-16  9:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-16  9:24 [PATCH v2 00/10] Add definition for the number of standard PCI BARs Denis Efremov
2019-08-16  9:24 ` [PATCH v2 01/10] PCI: Add define " Denis Efremov
2019-08-16  9:24 ` [PATCH v2 02/10] s390/pci: Loop using PCI_STD_NUM_BARS Denis Efremov
2019-08-16 10:45   ` Sebastian Ott
2019-08-16  9:24 ` [PATCH v2 03/10] x86/PCI: " Denis Efremov
2019-08-16  9:32   ` Thomas Gleixner
2019-08-16 13:31     ` Bjorn Helgaas
2019-08-16  9:24 ` [PATCH v2 04/10] stmmac: pci: " Denis Efremov
2019-08-16  9:24 ` [PATCH v2 05/10] net: dwc-xlgmac: " Denis Efremov
2019-08-16  9:24 ` [PATCH v2 06/10] rapidio/tsi721: " Denis Efremov
2019-08-16  9:24 ` [PATCH v2 07/10] efifb: " Denis Efremov
2019-08-16  9:24 ` [PATCH v2 08/10] vfio_pci: " Denis Efremov
2019-08-16 16:23   ` Alex Williamson
2019-08-16  9:24 ` [PATCH v2 09/10] PCI: hv: Use PCI_STD_NUM_BARS Denis Efremov
2019-08-16  9:24 ` Denis Efremov [this message]
2019-08-16 10:51 ` [PATCH v2 00/10] Add definition for the number of standard PCI BARs Andrew Murray
2019-08-16 13:35   ` Bjorn Helgaas
2019-09-05 19:02   ` Denis Efremov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190816092437.31846-11-efremov@linux.com \
    --to=efremov@linux.com \
    --cc=andrew.murray@arm.com \
    --cc=bhelgaas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).