Skip to content

Commit

Permalink
PCI: Simplify pci_read_bridge_bases() logic
Browse files Browse the repository at this point in the history
Use reverse logic combined with return and continue to significantly
reduce indentation level in pci_read_bridge_bases().

Link: https://lore.kernel.org/r/20241017141111.44612-3-ilpo.jarvinen@linux.intel.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
  • Loading branch information
ij-intel authored and bjorn-helgaas committed Oct 18, 2024
1 parent 469c9cb commit 32ec7b3
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions drivers/pci/probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -543,14 +543,15 @@ void pci_read_bridge_bases(struct pci_bus *child)
pci_read_bridge_mmio(child->self, child->resource[1], false);
pci_read_bridge_mmio_pref(child->self, child->resource[2], false);

if (dev->transparent) {
pci_bus_for_each_resource(child->parent, res) {
if (res && res->flags) {
pci_bus_add_resource(child, res);
pci_info(dev, " bridge window %pR (subtractive decode)\n",
res);
}
}
if (!dev->transparent)
return;

pci_bus_for_each_resource(child->parent, res) {
if (!res || !res->flags)
continue;

pci_bus_add_resource(child, res);
pci_info(dev, " bridge window %pR (subtractive decode)\n", res);
}
}

Expand Down

0 comments on commit 32ec7b3

Please sign in to comment.