All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Thumshirn <jthumshirn@suse.de>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	Christoph Hellwig <hch@infradead.org>,
	Johannes Thumshirn <jthumshirn@suse.de>,
	Keith Busch <keith.busch@intel.com>, Jens Axboe <axboe@fb.com>,
	linux-nvme@lists.infradead.org
Subject: [PATCH v3 2/6] NVMe: Use pci_(request|release)_mem_regions
Date: Tue,  7 Jun 2016 09:44:02 +0200	[thread overview]
Message-ID: <5c9932602e6d43ef8ad77856c686765f9e63aa9c.1465200424.git.jthumshirn@suse.de> (raw)
In-Reply-To: <cover.1465200424.git.jthumshirn@suse.de>
In-Reply-To: <cover.1465200424.git.jthumshirn@suse.de>

Now that we do have pci_request_mem_regions() and pci_release_mem_regions() at
hand, use it in the NVMe driver.

Suggested-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Keith Busch <keith.busch@intel.com>
Cc: Jens Axboe <axboe@fb.com>
Cc: linux-nvme@lists.infradead.org
---
 drivers/nvme/host/pci.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 4fd733f..e7d17ae 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1756,7 +1756,7 @@ static void nvme_dev_unmap(struct nvme_dev *dev)
 {
 	if (dev->bar)
 		iounmap(dev->bar);
-	pci_release_regions(to_pci_dev(dev->dev));
+	pci_release_mem_regions(to_pci_dev(dev->dev));
 }
 
 static void nvme_pci_disable(struct nvme_dev *dev)
@@ -1979,13 +1979,9 @@ static const struct nvme_ctrl_ops nvme_pci_ctrl_ops = {
 
 static int nvme_dev_map(struct nvme_dev *dev)
 {
-	int bars;
 	struct pci_dev *pdev = to_pci_dev(dev->dev);
 
-	bars = pci_select_bars(pdev, IORESOURCE_MEM);
-	if (!bars)
-		return -ENODEV;
-	if (pci_request_selected_regions(pdev, bars, "nvme"))
+	if (pci_request_mem_regions(pdev, "nvme"))
 		return -ENODEV;
 
 	dev->bar = ioremap(pci_resource_start(pdev, 0), 8192);
@@ -1994,7 +1990,7 @@ static int nvme_dev_map(struct nvme_dev *dev)
 
        return 0;
   release:
-       pci_release_regions(pdev);
+       pci_release_mem_regions(pdev);
        return -ENODEV;
 }
 
-- 
1.8.5.6

WARNING: multiple messages have this Message-ID (diff)
From: jthumshirn@suse.de (Johannes Thumshirn)
Subject: [PATCH v3 2/6] NVMe: Use pci_(request|release)_mem_regions
Date: Tue,  7 Jun 2016 09:44:02 +0200	[thread overview]
Message-ID: <5c9932602e6d43ef8ad77856c686765f9e63aa9c.1465200424.git.jthumshirn@suse.de> (raw)
In-Reply-To: <cover.1465200424.git.jthumshirn@suse.de>

Now that we do have pci_request_mem_regions() and pci_release_mem_regions() at
hand, use it in the NVMe driver.

Suggested-by: Christoph Hellwig <hch at infradead.org>
Signed-off-by: Johannes Thumshirn <jthumshirn at suse.de>
Reviewed-by: Christoph Hellwig <hch at lst.de>
Cc: Christoph Hellwig <hch at infradead.org>
Cc: Keith Busch <keith.busch at intel.com>
Cc: Jens Axboe <axboe at fb.com>
Cc: linux-nvme at lists.infradead.org
---
 drivers/nvme/host/pci.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 4fd733f..e7d17ae 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1756,7 +1756,7 @@ static void nvme_dev_unmap(struct nvme_dev *dev)
 {
 	if (dev->bar)
 		iounmap(dev->bar);
-	pci_release_regions(to_pci_dev(dev->dev));
+	pci_release_mem_regions(to_pci_dev(dev->dev));
 }
 
 static void nvme_pci_disable(struct nvme_dev *dev)
@@ -1979,13 +1979,9 @@ static const struct nvme_ctrl_ops nvme_pci_ctrl_ops = {
 
 static int nvme_dev_map(struct nvme_dev *dev)
 {
-	int bars;
 	struct pci_dev *pdev = to_pci_dev(dev->dev);
 
-	bars = pci_select_bars(pdev, IORESOURCE_MEM);
-	if (!bars)
-		return -ENODEV;
-	if (pci_request_selected_regions(pdev, bars, "nvme"))
+	if (pci_request_mem_regions(pdev, "nvme"))
 		return -ENODEV;
 
 	dev->bar = ioremap(pci_resource_start(pdev, 0), 8192);
@@ -1994,7 +1990,7 @@ static int nvme_dev_map(struct nvme_dev *dev)
 
        return 0;
   release:
-       pci_release_regions(pdev);
+       pci_release_mem_regions(pdev);
        return -ENODEV;
 }
 
-- 
1.8.5.6

  parent reply	other threads:[~2016-06-07  7:44 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-07  7:44 [PATCH v3 0/6] Introduce pci_(request|release)_(mem|io)_regions Johannes Thumshirn
2016-06-07  7:44 ` [Intel-wired-lan] " Johannes Thumshirn
2016-06-07  7:44 ` Johannes Thumshirn
2016-06-07  7:44 ` [PATCH v3 1/6] PCI: Add helpers to request/release memory and I/O regions Johannes Thumshirn
2016-06-07  7:44 ` Johannes Thumshirn [this message]
2016-06-07  7:44   ` [PATCH v3 2/6] NVMe: Use pci_(request|release)_mem_regions Johannes Thumshirn
2016-06-17 11:27   ` Johannes Thumshirn
2016-06-17 11:27     ` Johannes Thumshirn
2016-06-21 22:27     ` Bjorn Helgaas
2016-06-21 22:27       ` Bjorn Helgaas
2016-06-07  7:44 ` [PATCH v3 3/6] lpfc: " Johannes Thumshirn
2016-06-07  7:44 ` [PATCH v3 4/6] GenWQE: " Johannes Thumshirn
2016-06-07  7:44 ` [PATCH v3 5/6] ethernet/intel: " Johannes Thumshirn
2016-06-07  7:44   ` [Intel-wired-lan] " Johannes Thumshirn
2016-06-07  7:44 ` [PATCH v3 6/6] alx: " Johannes Thumshirn
2016-06-07  7:44   ` [Intel-wired-lan] " Johannes Thumshirn
2016-06-07 11:57 ` [PATCH v3 0/6] Introduce pci_(request|release)_(mem|io)_regions Christoph Hellwig
2016-06-07 11:57   ` [Intel-wired-lan] " Christoph Hellwig
2016-06-07 11:57   ` Christoph Hellwig
2016-06-08  7:28 ` Johannes Thumshirn
2016-06-08  7:28   ` [Intel-wired-lan] " Johannes Thumshirn
2016-06-08  7:28   ` Johannes Thumshirn
2016-06-08 23:04   ` Jeff Kirsher
2016-06-08 23:04     ` [Intel-wired-lan] " Jeff Kirsher
2016-06-08 23:04     ` Jeff Kirsher
2016-06-21 22:28 ` Bjorn Helgaas
2016-06-21 22:28   ` [Intel-wired-lan] " Bjorn Helgaas
2016-06-21 22:28   ` Bjorn Helgaas

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=5c9932602e6d43ef8ad77856c686765f9e63aa9c.1465200424.git.jthumshirn@suse.de \
    --to=jthumshirn@suse.de \
    --cc=axboe@fb.com \
    --cc=bhelgaas@google.com \
    --cc=hch@infradead.org \
    --cc=keith.busch@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.