[PATCH] ppc64: pci_bus_to_host() simplification

Benjamin Herrenschmidt benh at kernel.crashing.org
Mon Nov 22 12:52:33 EST 2004


Hi !

The pci_bus_to_host() inline function used on ppc64 to find the pci_contoller
structure a give pci_bus resides on used to contain bogus tree walking code,
which fortunately ended up never beeing necessary since "sysdata" always points
to a device_node structure that has the proper "phb" field (even if it is not
the device-node of the actual P2P, which happens during boot).

Signed-off-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>

Index: linux-work/include/asm-ppc64/pci-bridge.h
===================================================================
--- linux-work.orig/include/asm-ppc64/pci-bridge.h	2004-11-22 11:50:50.000000000 +1100
+++ linux-work/include/asm-ppc64/pci-bridge.h	2004-11-22 12:45:52.695424456 +1100
@@ -88,17 +88,9 @@
 
 static inline struct pci_controller *pci_bus_to_host(struct pci_bus *bus)
 {
-	struct device_node *busdn;
+	struct device_node *busdn = bus->sysdata;
 
-	busdn = bus->sysdata;
-	if (busdn == 0) {
-		struct pci_bus *b;
-		for (b = bus->parent; b && bus->sysdata == 0; b = b->parent)
-			;
-		busdn = b->sysdata;
-	}
-	if (busdn == NULL)
-		return NULL;
+	BUG_ON(busdn == NULL);
 	return busdn->phb;
 }
 





More information about the Linuxppc64-dev mailing list