diff options
author | Matthew Wilcox <matthew.r.wilcox@intel.com> | 2011-02-01 16:24:35 -0500 |
---|---|---|
committer | Matthew Wilcox <matthew.r.wilcox@intel.com> | 2011-11-04 15:52:54 -0400 |
commit | 574e8b95bc3780e10e9b5e9d51074d503dd3d5d9 (patch) | |
tree | 084c993dd157fe9d3bfd427cbbdabcc6a618b6be /drivers/block/nvme.c | |
parent | 2930353f9f2b9e4629e935acd970cb73c1171229 (diff) |
NVMe: Request I/O regions
Calling pci_request_selected_regions() reserves these regions for our use.
Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
Diffstat (limited to 'drivers/block/nvme.c')
-rw-r--r-- | drivers/block/nvme.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/block/nvme.c b/drivers/block/nvme.c index 46f872021369..bda91178f475 100644 --- a/drivers/block/nvme.c +++ b/drivers/block/nvme.c | |||
@@ -1088,7 +1088,7 @@ static void nvme_release_instance(struct nvme_dev *dev) | |||
1088 | static int __devinit nvme_probe(struct pci_dev *pdev, | 1088 | static int __devinit nvme_probe(struct pci_dev *pdev, |
1089 | const struct pci_device_id *id) | 1089 | const struct pci_device_id *id) |
1090 | { | 1090 | { |
1091 | int result = -ENOMEM; | 1091 | int bars, result = -ENOMEM; |
1092 | struct nvme_dev *dev; | 1092 | struct nvme_dev *dev; |
1093 | 1093 | ||
1094 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); | 1094 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
@@ -1106,6 +1106,9 @@ static int __devinit nvme_probe(struct pci_dev *pdev, | |||
1106 | if (pci_enable_device_mem(pdev)) | 1106 | if (pci_enable_device_mem(pdev)) |
1107 | goto free; | 1107 | goto free; |
1108 | pci_set_master(pdev); | 1108 | pci_set_master(pdev); |
1109 | bars = pci_select_bars(pdev, IORESOURCE_MEM); | ||
1110 | if (pci_request_selected_regions(pdev, bars, "nvme")) | ||
1111 | goto disable; | ||
1109 | 1112 | ||
1110 | INIT_LIST_HEAD(&dev->namespaces); | 1113 | INIT_LIST_HEAD(&dev->namespaces); |
1111 | dev->pci_dev = pdev; | 1114 | dev->pci_dev = pdev; |
@@ -1118,7 +1121,7 @@ static int __devinit nvme_probe(struct pci_dev *pdev, | |||
1118 | dev->bar = ioremap(pci_resource_start(pdev, 0), 8192); | 1121 | dev->bar = ioremap(pci_resource_start(pdev, 0), 8192); |
1119 | if (!dev->bar) { | 1122 | if (!dev->bar) { |
1120 | result = -ENOMEM; | 1123 | result = -ENOMEM; |
1121 | goto disable; | 1124 | goto disable_msix; |
1122 | } | 1125 | } |
1123 | 1126 | ||
1124 | result = nvme_configure_admin_queue(dev); | 1127 | result = nvme_configure_admin_queue(dev); |
@@ -1135,10 +1138,12 @@ static int __devinit nvme_probe(struct pci_dev *pdev, | |||
1135 | nvme_free_queues(dev); | 1138 | nvme_free_queues(dev); |
1136 | unmap: | 1139 | unmap: |
1137 | iounmap(dev->bar); | 1140 | iounmap(dev->bar); |
1138 | disable: | 1141 | disable_msix: |
1139 | pci_disable_msix(pdev); | 1142 | pci_disable_msix(pdev); |
1140 | nvme_release_instance(dev); | 1143 | nvme_release_instance(dev); |
1144 | disable: | ||
1141 | pci_disable_device(pdev); | 1145 | pci_disable_device(pdev); |
1146 | pci_release_regions(pdev); | ||
1142 | free: | 1147 | free: |
1143 | kfree(dev->queues); | 1148 | kfree(dev->queues); |
1144 | kfree(dev->entry); | 1149 | kfree(dev->entry); |
@@ -1154,6 +1159,7 @@ static void __devexit nvme_remove(struct pci_dev *pdev) | |||
1154 | iounmap(dev->bar); | 1159 | iounmap(dev->bar); |
1155 | nvme_release_instance(dev); | 1160 | nvme_release_instance(dev); |
1156 | pci_disable_device(pdev); | 1161 | pci_disable_device(pdev); |
1162 | pci_release_regions(pdev); | ||
1157 | kfree(dev->queues); | 1163 | kfree(dev->queues); |
1158 | kfree(dev->entry); | 1164 | kfree(dev->entry); |
1159 | kfree(dev); | 1165 | kfree(dev); |