diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2017-10-20 15:38:54 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2017-11-06 18:48:58 -0600 |
commit | 24a0c654d7d6063301c51361f911369264342b3c (patch) | |
tree | 22d07a3196b6e8ca3ed23e5b68dcd320488b5ba7 /drivers/pcmcia | |
parent | 3691314a905fd716de46735d944da3f374246550 (diff) | |
download | linux-24a0c654d7d6063301c51361f911369264342b3c.tar.gz linux-24a0c654d7d6063301c51361f911369264342b3c.tar.bz2 linux-24a0c654d7d6063301c51361f911369264342b3c.zip |
PCI: Add for_each_pci_bridge() helper
The following pattern is often used:
list_for_each_entry(dev, &bus->devices, bus_list) {
if (pci_is_bridge(dev)) {
...
}
}
Add a for_each_pci_bridge() helper to make that code easier to write and
read by reducing indentation level. It also saves one or few lines of code
in each occurrence.
Convert PCI core parts here at the same time.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
[bhelgaas: fold in http://lkml.kernel.org/r/20171013165352.25550-1-andriy.shevchenko@linux.intel.com]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r-- | drivers/pcmcia/cardbus.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/pcmcia/cardbus.c b/drivers/pcmcia/cardbus.c index 4fe4cc4ae19a..5c0170597037 100644 --- a/drivers/pcmcia/cardbus.c +++ b/drivers/pcmcia/cardbus.c @@ -77,9 +77,8 @@ int __ref cb_alloc(struct pcmcia_socket *s) max = bus->busn_res.start; for (pass = 0; pass < 2; pass++) - list_for_each_entry(dev, &bus->devices, bus_list) - if (pci_is_bridge(dev)) - max = pci_scan_bridge(bus, dev, max, pass); + for_each_pci_bridge(dev, bus) + max = pci_scan_bridge(bus, dev, max, pass); /* * Size all resources below the CardBus controller. |