aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2016-05-31 13:05:05 -0400
committerBjorn Helgaas <bhelgaas@google.com>2016-06-21 11:09:37 -0400
commitb7f957ac272cb6f7a36536a1801b4da453df9c9b (patch)
tree545ce877e5c600b0e4d437d5921612e525ce8600
parentba4f6d9201a7b8840786a29bfe5020cc06bf0f19 (diff)
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: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r--drivers/pci/host/pci-host-common.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/pci/host/pci-host-common.c b/drivers/pci/host/pci-host-common.c
index 8cba7ab73df9..533d50c500a9 100644
--- a/drivers/pci/host/pci-host-common.c
+++ b/drivers/pci/host/pci-host-common.c
@@ -36,12 +36,15 @@ static int gen_pci_parse_request_of_pci_ranges(struct device *dev,
36 if (err) 36 if (err)
37 return err; 37 return err;
38 38
39 err = devm_request_pci_bus_resources(dev, resources);
40 if (err)
41 goto out_release_res;
42
39 resource_list_for_each_entry(win, resources) { 43 resource_list_for_each_entry(win, resources) {
40 struct resource *parent, *res = win->res; 44 struct resource *res = win->res;
41 45
42 switch (resource_type(res)) { 46 switch (resource_type(res)) {
43 case IORESOURCE_IO: 47 case IORESOURCE_IO:
44 parent = &ioport_resource;
45 err = pci_remap_iospace(res, iobase); 48 err = pci_remap_iospace(res, iobase);
46 if (err) { 49 if (err) {
47 dev_warn(dev, "error %d: failed to map resource %pR\n", 50 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 } 53 }
51 break; 54 break;
52 case IORESOURCE_MEM: 55 case IORESOURCE_MEM:
53 parent = &iomem_resource;
54 res_valid |= !(res->flags & IORESOURCE_PREFETCH); 56 res_valid |= !(res->flags & IORESOURCE_PREFETCH);
55 break; 57 break;
56 case IORESOURCE_BUS: 58 case IORESOURCE_BUS:
@@ -58,10 +60,6 @@ static int gen_pci_parse_request_of_pci_ranges(struct device *dev,
58 default: 60 default:
59 continue; 61 continue;
60 } 62 }
61
62 err = devm_request_resource(dev, parent, res);
63 if (err)
64 goto out_release_res;
65 } 63 }
66 64
67 if (!res_valid) { 65 if (!res_valid) {