[PATCH 07/27] powerpc: ppc_md.pci_dma_dev_setup -> pci_controller_ops.dma_dev_setup

Daniel Axtens dja at axtens.net
Wed Mar 25 16:35:41 AEDT 2015


Signed-off-by: Daniel Axtens <dja at axtens.net>
---
 arch/powerpc/include/asm/pci-bridge.h | 14 ++++++++++++++
 arch/powerpc/kernel/pci-common.c      |  3 +--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index 3ab8a2d..2474f29 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -18,6 +18,7 @@ struct device_node;
  * PCI controller operations
  */
 struct pci_controller_ops {
+	void		(*dma_dev_setup)(struct pci_dev *dev);
 };
 
 /*
@@ -265,5 +266,18 @@ static inline int pcibios_vaddr_is_ioport(void __iomem *address)
 }
 #endif	/* CONFIG_PCI */
 
+/*
+ * Shims to prefer pci_controller version over ppc_md where available.
+ */
+static inline void dma_dev_setup(struct pci_dev *dev)
+{
+	struct pci_controller *hose = pci_bus_to_host(dev->bus);
+
+	if (hose->controller_ops.dma_dev_setup)
+		hose->controller_ops.dma_dev_setup(dev);
+	else if (ppc_md.pci_dma_dev_setup)
+		ppc_md.pci_dma_dev_setup(dev);
+}
+
 #endif	/* __KERNEL__ */
 #endif	/* _ASM_POWERPC_PCI_BRIDGE_H */
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 3d07d81..3ce6d0c 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -969,8 +969,7 @@ static void pcibios_setup_device(struct pci_dev *dev)
 	set_dma_offset(&dev->dev, PCI_DRAM_OFFSET);
 
 	/* Additional platform DMA/iommu setup */
-	if (ppc_md.pci_dma_dev_setup)
-		ppc_md.pci_dma_dev_setup(dev);
+	dma_dev_setup(dev);
 
 	/* Read default IRQs and fixup if necessary */
 	pci_read_irq_line(dev);
-- 
2.1.4



More information about the Linuxppc-dev mailing list