Skip to contentSkip to conversation

powerpc/pci: convert to use for_each_pci_bridge() helper

PATCH In review Andy Shevchenko 3 participants 6 messages Oct 13, 2017 – Nov 8, 2017 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/pci: convert to use for_each_pci_bridge() helper

...which makes code slightly cleaner.

Requires: d43f59ce6c50 ("PCI: Add for_each_pci_bridge() helper")

---
 arch/powerpc/kernel/pci-hotplug.c | 7 ++-----
 arch/powerpc/kernel/pci_of_scan.c | 7 ++-----
 2 files changed, 4 insertions(+), 10 deletions(-)
arch/powerpc/kernel/pci-hotplug.c +2 -5
index 2d71269e7dc1..741f47295188 100644
@@ -134,11 +134,8 @@ void pci_hp_add_devices(struct pci_bus *bus)
 		pcibios_setup_bus_devices(bus);
 		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);
 		}
 	}
 	pcibios_finish_adding_to_bus(bus);
arch/powerpc/kernel/pci_of_scan.c +2 -5
index 0d790f8432d2..8bdaa2a6fa62 100644
@@ -369,11 +369,8 @@ static void __of_scan_bus(struct device_node *node, struct pci_bus *bus,
 	pcibios_setup_bus_devices(bus);
 
 	/* Now scan child busses */
-	list_for_each_entry(dev, &bus->devices, bus_list) {
-		if (pci_is_bridge(dev)) {
-			of_scan_pci_bridge(dev);
-		}
-	}
+	for_each_pci_bridge(dev, bus)
+		of_scan_pci_bridge(dev);
 }
 
 /**
Signature · 1 line
2.14.2
#1 lore raw
Quoted 1 line · Andy Shevchenko

...which makes code slightly cleaner.

+Cc: Bjorn

Perhaps it makes sense to pass this through PCI if no one objects?

Quoted 51 lines

Requires: d43f59ce6c50 ("PCI: Add for_each_pci_bridge() helper")

---
 arch/powerpc/kernel/pci-hotplug.c | 7 ++-----
 arch/powerpc/kernel/pci_of_scan.c | 7 ++-----
 2 files changed, 4 insertions(+), 10 deletions(-)
arch/powerpc/kernel/pci-hotplug.c +2 -5
index 2d71269e7dc1..741f47295188 100644
@@ -134,11 +134,8 @@ void pci_hp_add_devices(struct pci_bus *bus)
 		pcibios_setup_bus_devices(bus);
 		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);

arch/powerpc/kernel/pci-hotplug.c +0 -0
 		}
 	}
 	pcibios_finish_adding_to_bus(bus);
arch/powerpc/kernel/pci_of_scan.c +2 -5
index 0d790f8432d2..8bdaa2a6fa62 100644
@@ -369,11 +369,8 @@ static void __of_scan_bus(struct device_node
 *node, struct pci_bus *bus,
 	pcibios_setup_bus_devices(bus);
 
 	/* Now scan child busses */
-	list_for_each_entry(dev, &bus->devices, bus_list) {
-		if (pci_is_bridge(dev)) {
-			of_scan_pci_bridge(dev);
-		}
-	}
+	for_each_pci_bridge(dev, bus)
+		of_scan_pci_bridge(dev);
 }
 

/**

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#2 lore raw
Quoted 6 lines · Andy Shevchenko
Quoted 1 line · Andy Shevchenko

...which makes code slightly cleaner.

+Cc: Bjorn

Perhaps it makes sense to pass this through PCI if no one objects?

Fine with me, but I only apply things that appear on the [email protected] mailing list.

Quoted 54 lines
Quoted 49 lines

Requires: d43f59ce6c50 ("PCI: Add for_each_pci_bridge() helper")

---
 arch/powerpc/kernel/pci-hotplug.c | 7 ++-----
 arch/powerpc/kernel/pci_of_scan.c | 7 ++-----
 2 files changed, 4 insertions(+), 10 deletions(-)
arch/powerpc/kernel/pci-hotplug.c +2 -5
index 2d71269e7dc1..741f47295188 100644
@@ -134,11 +134,8 @@ void pci_hp_add_devices(struct pci_bus *bus)
              pcibios_setup_bus_devices(bus);
              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);
              }
      }
      pcibios_finish_adding_to_bus(bus);
arch/powerpc/kernel/pci_of_scan.c +2 -5
index 0d790f8432d2..8bdaa2a6fa62 100644
@@ -369,11 +369,8 @@ static void __of_scan_bus(struct device_node
 *node, struct pci_bus *bus,
      pcibios_setup_bus_devices(bus);
 
      /* Now scan child busses */
-     list_for_each_entry(dev, &bus->devices, bus_list) {
-             if (pci_is_bridge(dev)) {
-                     of_scan_pci_bridge(dev);
-             }
-     }
+     for_each_pci_bridge(dev, bus)
+             of_scan_pci_bridge(dev);
 }
 
Quoted 1 line

/**

--
Andy Shevchenko <[email protected]> Intel Finland Oy

#3 lore raw
Quoted 11 lines · Bjorn Helgaas
Quoted 6 lines · Andy Shevchenko
Quoted 1 line · Andy Shevchenko

...which makes code slightly cleaner.

+Cc: Bjorn

Perhaps it makes sense to pass this through PCI if no one objects?

Fine with me, but I only apply things that appear on the [email protected] mailing list.

I want to wait for powerpc maintainers to Ack and then I'll resend.

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#4 lore raw
Quoted 6 lines · Andy Shevchenko
Quoted 5 lines · Bjorn Helgaas
Quoted 3 lines · Andy Shevchenko
Quoted 1 line · Andy Shevchenko

...which makes code slightly cleaner.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

+Cc: Bjorn

Perhaps it makes sense to pass this through PCI if no one objects?

Fine with me, but I only apply things that appear on the [email protected] mailing list.

I want to wait for powerpc maintainers to Ack and then I'll resend.

Michael, Paul, Benjamin, do you have any concerns on this patch?

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
reviewer Acked-by
#5 lore raw
Quoted 9 lines · Andy Shevchenko
Quoted 8 lines · Andy Shevchenko
Quoted 7 lines · Bjorn Helgaas
Quoted 5 lines · Andy Shevchenko
Quoted 1 line · Andy Shevchenko

...which makes code slightly cleaner.

+Cc: Bjorn

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Perhaps it makes sense to pass this through PCI if no one objects?

Fine with me, but I only apply things that appear on the [email protected] mailing list.

I want to wait for powerpc maintainers to Ack and then I'll resend.

Michael, Paul, Benjamin, do you have any concerns on this patch?

No, assuming it does what it says :)

cheers