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

GenWQE: 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 genwqe driver.

[bhelgaas: fix build issues]
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: Frank Haverkamp <haver@linux.vnet.ibm.com>
CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e0c0483c
...@@ -182,7 +182,7 @@ static void genwqe_dev_free(struct genwqe_dev *cd) ...@@ -182,7 +182,7 @@ static void genwqe_dev_free(struct genwqe_dev *cd)
*/ */
static int genwqe_bus_reset(struct genwqe_dev *cd) static int genwqe_bus_reset(struct genwqe_dev *cd)
{ {
int bars, rc = 0; int rc = 0;
struct pci_dev *pci_dev = cd->pci_dev; struct pci_dev *pci_dev = cd->pci_dev;
void __iomem *mmio; void __iomem *mmio;
...@@ -193,8 +193,7 @@ static int genwqe_bus_reset(struct genwqe_dev *cd) ...@@ -193,8 +193,7 @@ static int genwqe_bus_reset(struct genwqe_dev *cd)
cd->mmio = NULL; cd->mmio = NULL;
pci_iounmap(pci_dev, mmio); pci_iounmap(pci_dev, mmio);
bars = pci_select_bars(pci_dev, IORESOURCE_MEM); pci_release_mem_regions(pci_dev);
pci_release_selected_regions(pci_dev, bars);
/* /*
* Firmware/BIOS might change memory mapping during bus reset. * Firmware/BIOS might change memory mapping during bus reset.
...@@ -218,7 +217,7 @@ static int genwqe_bus_reset(struct genwqe_dev *cd) ...@@ -218,7 +217,7 @@ static int genwqe_bus_reset(struct genwqe_dev *cd)
GENWQE_INJECT_GFIR_FATAL | GENWQE_INJECT_GFIR_FATAL |
GENWQE_INJECT_GFIR_INFO); GENWQE_INJECT_GFIR_INFO);
rc = pci_request_selected_regions(pci_dev, bars, genwqe_driver_name); rc = pci_request_mem_regions(pci_dev, genwqe_driver_name);
if (rc) { if (rc) {
dev_err(&pci_dev->dev, dev_err(&pci_dev->dev,
"[%s] err: request bars failed (%d)\n", __func__, rc); "[%s] err: request bars failed (%d)\n", __func__, rc);
...@@ -1068,10 +1067,9 @@ static int genwqe_health_check_stop(struct genwqe_dev *cd) ...@@ -1068,10 +1067,9 @@ static int genwqe_health_check_stop(struct genwqe_dev *cd)
*/ */
static int genwqe_pci_setup(struct genwqe_dev *cd) static int genwqe_pci_setup(struct genwqe_dev *cd)
{ {
int err, bars; int err;
struct pci_dev *pci_dev = cd->pci_dev; struct pci_dev *pci_dev = cd->pci_dev;
bars = pci_select_bars(pci_dev, IORESOURCE_MEM);
err = pci_enable_device_mem(pci_dev); err = pci_enable_device_mem(pci_dev);
if (err) { if (err) {
dev_err(&pci_dev->dev, dev_err(&pci_dev->dev,
...@@ -1080,7 +1078,7 @@ static int genwqe_pci_setup(struct genwqe_dev *cd) ...@@ -1080,7 +1078,7 @@ static int genwqe_pci_setup(struct genwqe_dev *cd)
} }
/* Reserve PCI I/O and memory resources */ /* Reserve PCI I/O and memory resources */
err = pci_request_selected_regions(pci_dev, bars, genwqe_driver_name); err = pci_request_mem_regions(pci_dev, genwqe_driver_name);
if (err) { if (err) {
dev_err(&pci_dev->dev, dev_err(&pci_dev->dev,
"[%s] err: request bars failed (%d)\n", __func__, err); "[%s] err: request bars failed (%d)\n", __func__, err);
...@@ -1142,7 +1140,7 @@ static int genwqe_pci_setup(struct genwqe_dev *cd) ...@@ -1142,7 +1140,7 @@ static int genwqe_pci_setup(struct genwqe_dev *cd)
out_iounmap: out_iounmap:
pci_iounmap(pci_dev, cd->mmio); pci_iounmap(pci_dev, cd->mmio);
out_release_resources: out_release_resources:
pci_release_selected_regions(pci_dev, bars); pci_release_mem_regions(pci_dev);
err_disable_device: err_disable_device:
pci_disable_device(pci_dev); pci_disable_device(pci_dev);
err_out: err_out:
...@@ -1154,14 +1152,12 @@ static int genwqe_pci_setup(struct genwqe_dev *cd) ...@@ -1154,14 +1152,12 @@ static int genwqe_pci_setup(struct genwqe_dev *cd)
*/ */
static void genwqe_pci_remove(struct genwqe_dev *cd) static void genwqe_pci_remove(struct genwqe_dev *cd)
{ {
int bars;
struct pci_dev *pci_dev = cd->pci_dev; struct pci_dev *pci_dev = cd->pci_dev;
if (cd->mmio) if (cd->mmio)
pci_iounmap(pci_dev, cd->mmio); pci_iounmap(pci_dev, cd->mmio);
bars = pci_select_bars(pci_dev, IORESOURCE_MEM); pci_release_mem_regions(pci_dev);
pci_release_selected_regions(pci_dev, bars);
pci_disable_device(pci_dev); pci_disable_device(pci_dev);
} }
......
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