Commit ba4f6d92 authored by Bjorn Helgaas's avatar Bjorn Helgaas

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: default avatarBjorn Helgaas <bhelgaas@google.com>
parent 74462284
...@@ -415,11 +415,6 @@ static void altera_pcie_isr(struct irq_desc *desc) ...@@ -415,11 +415,6 @@ static void altera_pcie_isr(struct irq_desc *desc)
chained_irq_exit(chip, 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) static int altera_pcie_parse_request_of_pci_ranges(struct altera_pcie *pcie)
{ {
int err, res_valid = 0; int err, res_valid = 0;
...@@ -439,25 +434,18 @@ static int altera_pcie_parse_request_of_pci_ranges(struct altera_pcie *pcie) ...@@ -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) { resource_list_for_each_entry(win, &pcie->resources) {
struct resource *res = win->res; struct resource *res = win->res;
switch (resource_type(res)) { if (resource_type(res) == IORESOURCE_MEM)
case IORESOURCE_MEM:
res_valid |= !(res->flags & IORESOURCE_PREFETCH); res_valid |= !(res->flags & IORESOURCE_PREFETCH);
break;
default:
continue;
}
} }
if (!res_valid) { if (res_valid)
dev_err(dev, "non-prefetchable memory resource required\n"); return 0;
err = -EINVAL;
goto out_release_res;
}
return 0; dev_err(dev, "non-prefetchable memory resource required\n");
err = -EINVAL;
out_release_res: out_release_res:
altera_pcie_release_of_pci_ranges(pcie); pci_free_resource_list(&pcie->resources);
return err; return err;
} }
......
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