diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2016-05-28 18:33:46 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2016-06-20 14:06:06 -0500 |
commit | ba4f6d9201a7b8840786a29bfe5020cc06bf0f19 (patch) | |
tree | 0da16648e07953b0ca7c3273871e8f28e4a39f44 /drivers | |
parent | 74462284bdda85216c3cf49d52920d4164f47e80 (diff) | |
download | blackbird-op-linux-ba4f6d9201a7b8840786a29bfe5020cc06bf0f19.tar.gz blackbird-op-linux-ba4f6d9201a7b8840786a29bfe5020cc06bf0f19.zip |
PCI: altera: Simplify host bridge window iteration
The switch is the only statement in the resource_list_for_each_entry()
loop, so remove unnecessary "continue" statements in the switch. Simplify
checking for the required non-prefetchable memory aperture. Inline
altera_pcie_release_of_pci_ranges(), which is only called once.
No functional change intended.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/pci/host/pcie-altera.c | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/drivers/pci/host/pcie-altera.c b/drivers/pci/host/pcie-altera.c index b97abbcdba33..cf20c67a48f8 100644 --- a/drivers/pci/host/pcie-altera.c +++ b/drivers/pci/host/pcie-altera.c @@ -415,11 +415,6 @@ static void altera_pcie_isr(struct irq_desc *desc) chained_irq_exit(chip, desc); } -static void altera_pcie_release_of_pci_ranges(struct altera_pcie *pcie) -{ - pci_free_resource_list(&pcie->resources); -} - static int altera_pcie_parse_request_of_pci_ranges(struct altera_pcie *pcie) { int err, res_valid = 0; @@ -439,25 +434,18 @@ static int altera_pcie_parse_request_of_pci_ranges(struct altera_pcie *pcie) resource_list_for_each_entry(win, &pcie->resources) { struct resource *res = win->res; - switch (resource_type(res)) { - case IORESOURCE_MEM: + if (resource_type(res) == IORESOURCE_MEM) res_valid |= !(res->flags & IORESOURCE_PREFETCH); - break; - default: - continue; - } } - if (!res_valid) { - dev_err(dev, "non-prefetchable memory resource required\n"); - err = -EINVAL; - goto out_release_res; - } + if (res_valid) + return 0; - return 0; + dev_err(dev, "non-prefetchable memory resource required\n"); + err = -EINVAL; out_release_res: - altera_pcie_release_of_pci_ranges(pcie); + pci_free_resource_list(&pcie->resources); return err; } |