]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
powerpc/dma: remove get_pci_dma_ops
authorChristoph Hellwig <hch@lst.de>
Wed, 13 Feb 2019 07:01:18 +0000 (08:01 +0100)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 18 Feb 2019 11:41:03 +0000 (22:41 +1100)
This function is only used by the Cell iommu code, which can keep track
if it is using the iommu internally just as good.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Tested-by: Christian Zigotzky <chzigotzky@xenosoft.de>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/pci.h
arch/powerpc/kernel/pci-common.c
arch/powerpc/platforms/cell/iommu.c

index 0c72f1897063662caf1d1416a881e079badd0a32..6a1861a6301e4361f64e6eaa2275afcfe5e596c4 100644 (file)
@@ -52,10 +52,8 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
 
 #ifdef CONFIG_PCI
 extern void set_pci_dma_ops(const struct dma_map_ops *dma_ops);
-extern const struct dma_map_ops *get_pci_dma_ops(void);
 #else  /* CONFIG_PCI */
 #define set_pci_dma_ops(d)
-#define get_pci_dma_ops()      NULL
 #endif
 
 #ifdef CONFIG_PPC64
index 88e4f69a09e52624dd75c6e6aaa0d1f894d18758..a847076805254813c9c63dbb4770816b8d37df3c 100644 (file)
@@ -69,12 +69,6 @@ void set_pci_dma_ops(const struct dma_map_ops *dma_ops)
        pci_dma_ops = dma_ops;
 }
 
-const struct dma_map_ops *get_pci_dma_ops(void)
-{
-       return pci_dma_ops;
-}
-EXPORT_SYMBOL(get_pci_dma_ops);
-
 /*
  * This function should run under locking protection, specifically
  * hose_spinlock.
index 6663cd3e6bb6e2c94727f0e555cc36af8f171732..a3c4057a8f65d0794ae3804426c97801a2238228 100644 (file)
@@ -544,6 +544,7 @@ static struct cbe_iommu *cell_iommu_for_node(int nid)
 static unsigned long cell_dma_nommu_offset;
 
 static unsigned long dma_iommu_fixed_base;
+static bool cell_iommu_enabled;
 
 /* iommu_fixed_is_weak is set if booted with iommu_fixed=weak */
 bool iommu_fixed_is_weak;
@@ -572,16 +573,14 @@ static u64 cell_iommu_get_fixed_address(struct device *dev);
 
 static void cell_dma_dev_setup(struct device *dev)
 {
-       if (get_pci_dma_ops() == &dma_iommu_ops) {
+       if (cell_iommu_enabled) {
                u64 addr = cell_iommu_get_fixed_address(dev);
 
                if (addr != OF_BAD_ADDR)
                        set_dma_offset(dev, addr + dma_iommu_fixed_base);
                set_iommu_table_base(dev, cell_get_iommu_table(dev));
-       } else if (get_pci_dma_ops() == &dma_nommu_ops) {
-               set_dma_offset(dev, cell_dma_nommu_offset);
        } else {
-               BUG();
+               set_dma_offset(dev, cell_dma_nommu_offset);
        }
 }
 
@@ -599,11 +598,11 @@ static int cell_of_bus_notify(struct notifier_block *nb, unsigned long action,
        if (action != BUS_NOTIFY_ADD_DEVICE)
                return 0;
 
-       /* We use the PCI DMA ops */
-       dev->dma_ops = get_pci_dma_ops();
-
+       if (cell_iommu_enabled)
+               dev->dma_ops = &dma_iommu_ops;
+       else
+               dev->dma_ops = &dma_nommu_ops;
        cell_dma_dev_setup(dev);
-
        return 0;
 }
 
@@ -1093,7 +1092,7 @@ static int __init cell_iommu_init(void)
  done:
        /* Setup default PCI iommu ops */
        set_pci_dma_ops(&dma_iommu_ops);
-
+       cell_iommu_enabled = true;
  bail:
        /* Register callbacks on OF platform device addition/removal
         * to handle linking them to the right DMA operations