Commit b7f957ac authored by Bjorn Helgaas's avatar Bjorn Helgaas

PCI: generic: Request host bridge window resources with core function

Use devm_request_pci_bus_resources() to request host bridge window
resources instead of doing it by hand in the driver.

No functional change intended.
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent ba4f6d92
...@@ -36,12 +36,15 @@ static int gen_pci_parse_request_of_pci_ranges(struct device *dev, ...@@ -36,12 +36,15 @@ static int gen_pci_parse_request_of_pci_ranges(struct device *dev,
if (err) if (err)
return err; return err;
err = devm_request_pci_bus_resources(dev, resources);
if (err)
goto out_release_res;
resource_list_for_each_entry(win, resources) { resource_list_for_each_entry(win, resources) {
struct resource *parent, *res = win->res; struct resource *res = win->res;
switch (resource_type(res)) { switch (resource_type(res)) {
case IORESOURCE_IO: case IORESOURCE_IO:
parent = &ioport_resource;
err = pci_remap_iospace(res, iobase); err = pci_remap_iospace(res, iobase);
if (err) { if (err) {
dev_warn(dev, "error %d: failed to map resource %pR\n", dev_warn(dev, "error %d: failed to map resource %pR\n",
...@@ -50,7 +53,6 @@ static int gen_pci_parse_request_of_pci_ranges(struct device *dev, ...@@ -50,7 +53,6 @@ static int gen_pci_parse_request_of_pci_ranges(struct device *dev,
} }
break; break;
case IORESOURCE_MEM: case IORESOURCE_MEM:
parent = &iomem_resource;
res_valid |= !(res->flags & IORESOURCE_PREFETCH); res_valid |= !(res->flags & IORESOURCE_PREFETCH);
break; break;
case IORESOURCE_BUS: case IORESOURCE_BUS:
...@@ -58,10 +60,6 @@ static int gen_pci_parse_request_of_pci_ranges(struct device *dev, ...@@ -58,10 +60,6 @@ static int gen_pci_parse_request_of_pci_ranges(struct device *dev,
default: default:
continue; continue;
} }
err = devm_request_resource(dev, parent, res);
if (err)
goto out_release_res;
} }
if (!res_valid) { if (!res_valid) {
......
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