powerpc: Create pci_controller_ops.reset_secondary_bus and shim
authorDaniel Axtens <dja@axtens.net>
Tue, 31 Mar 2015 05:00:47 +0000 (16:00 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Sat, 11 Apr 2015 10:49:14 +0000 (20:49 +1000)
Add pci_controller_ops.reset_secondary_bus,
shadowing ppc_md.pcibios_reset_secondary_bus.
Add a shim, and changes the callsites to use the shim.

Use pcibios_reset_secondary_bus_shim, as both
pcibios_reset_secondary_bus and pci_reset_secondary_bus
are already taken.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/pci-bridge.h
arch/powerpc/kernel/pci-common.c

index ed4f8ce803bb8c19ca032886233adc51e866da84..bb34b1eebfbe2c4096a41518e6264eb0da098a54 100644 (file)
@@ -34,6 +34,7 @@ struct pci_controller_ops {
 
        /* Called during PCI resource reassignment */
        resource_size_t (*window_alignment)(struct pci_bus *, unsigned long type);
+       void            (*reset_secondary_bus)(struct pci_dev *dev);
 };
 
 /*
@@ -346,5 +347,21 @@ static inline resource_size_t pci_window_alignment(struct pci_bus *bus,
        return 1;
 }
 
+static inline void pcibios_reset_secondary_bus_shim(struct pci_dev *dev)
+{
+       struct pci_controller *phb = pci_bus_to_host(dev->bus);
+
+       if (phb->controller_ops.reset_secondary_bus)
+               phb->controller_ops.reset_secondary_bus(dev);
+       else if (ppc_md.pcibios_reset_secondary_bus)
+               ppc_md.pcibios_reset_secondary_bus(dev);
+       else
+               /*
+                * Fallback to the generic function if no
+                * platform-specific one is provided
+                */
+               pci_reset_secondary_bus(dev);
+}
+
 #endif /* __KERNEL__ */
 #endif /* _ASM_POWERPC_PCI_BRIDGE_H */
index 698e0328d9c31f844c5005fd923df105ac7fa7bf..759eb1c876387ecef4e73d4721ae9a31a8b4cad1 100644 (file)
@@ -114,12 +114,7 @@ resource_size_t pcibios_window_alignment(struct pci_bus *bus,
 
 void pcibios_reset_secondary_bus(struct pci_dev *dev)
 {
-       if (ppc_md.pcibios_reset_secondary_bus) {
-               ppc_md.pcibios_reset_secondary_bus(dev);
-               return;
-       }
-
-       pci_reset_secondary_bus(dev);
+       pcibios_reset_secondary_bus_shim(dev);
 }
 
 static resource_size_t pcibios_io_size(const struct pci_controller *hose)