Commit a1f447b3 authored by Johannes Thumshirn's avatar Johannes Thumshirn Committed by Bjorn Helgaas

NVMe: Use pci_(request|release)_mem_regions

Now that we do have pci_request_mem_regions() and pci_release_mem_regions()
at hand, use it in the NVMe driver.
Suggested-by: default avatarChristoph Hellwig <hch@infradead.org>
Signed-off-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
CC: Keith Busch <keith.busch@intel.com>
CC: Jens Axboe <axboe@fb.com>
parent be9d2e89
...@@ -1681,7 +1681,7 @@ static void nvme_dev_unmap(struct nvme_dev *dev) ...@@ -1681,7 +1681,7 @@ static void nvme_dev_unmap(struct nvme_dev *dev)
{ {
if (dev->bar) if (dev->bar)
iounmap(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) static void nvme_pci_disable(struct nvme_dev *dev)
...@@ -1909,13 +1909,9 @@ static const struct nvme_ctrl_ops nvme_pci_ctrl_ops = { ...@@ -1909,13 +1909,9 @@ static const struct nvme_ctrl_ops nvme_pci_ctrl_ops = {
static int nvme_dev_map(struct nvme_dev *dev) static int nvme_dev_map(struct nvme_dev *dev)
{ {
int bars;
struct pci_dev *pdev = to_pci_dev(dev->dev); struct pci_dev *pdev = to_pci_dev(dev->dev);
bars = pci_select_bars(pdev, IORESOURCE_MEM); if (pci_request_mem_regions(pdev, "nvme"))
if (!bars)
return -ENODEV;
if (pci_request_selected_regions(pdev, bars, "nvme"))
return -ENODEV; return -ENODEV;
dev->bar = ioremap(pci_resource_start(pdev, 0), 8192); dev->bar = ioremap(pci_resource_start(pdev, 0), 8192);
...@@ -1924,7 +1920,7 @@ static int nvme_dev_map(struct nvme_dev *dev) ...@@ -1924,7 +1920,7 @@ static int nvme_dev_map(struct nvme_dev *dev)
return 0; return 0;
release: release:
pci_release_regions(pdev); pci_release_mem_regions(pdev);
return -ENODEV; return -ENODEV;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment