]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
powerpc/vio: Use dma ops helpers
authorNishanth Aravamudan <nacc@us.ibm.com>
Mon, 18 Oct 2010 07:26:59 +0000 (07:26 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Mon, 29 Nov 2010 04:48:20 +0000 (15:48 +1100)
Use the set_dma_ops helper. Instead of modifying vio_dma_mapping_ops,
just create a trivial wrapper for dma_supported.

Signed-off-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/kernel/vio.c

index 441d2a722f0655b540b993c422c7f433585e1060..b2654058f2e40873336a1a93b0ef66e0e8adc32d 100644 (file)
@@ -600,6 +600,11 @@ static void vio_dma_iommu_unmap_sg(struct device *dev,
        vio_cmo_dealloc(viodev, alloc_size);
 }
 
+static int vio_dma_iommu_dma_supported(struct device *dev, u64 mask)
+{
+        return dma_iommu_ops.dma_supported(dev, mask);
+}
+
 struct dma_map_ops vio_dma_mapping_ops = {
        .alloc_coherent = vio_dma_iommu_alloc_coherent,
        .free_coherent  = vio_dma_iommu_free_coherent,
@@ -607,6 +612,7 @@ struct dma_map_ops vio_dma_mapping_ops = {
        .unmap_sg       = vio_dma_iommu_unmap_sg,
        .map_page       = vio_dma_iommu_map_page,
        .unmap_page     = vio_dma_iommu_unmap_page,
+       .dma_supported  = vio_dma_iommu_dma_supported,
 
 };
 
@@ -858,8 +864,7 @@ static void vio_cmo_bus_remove(struct vio_dev *viodev)
 
 static void vio_cmo_set_dma_ops(struct vio_dev *viodev)
 {
-       vio_dma_mapping_ops.dma_supported = dma_iommu_ops.dma_supported;
-       viodev->dev.archdata.dma_ops = &vio_dma_mapping_ops;
+       set_dma_ops(&viodev->dev, &vio_dma_mapping_ops);
 }
 
 /**
@@ -1244,7 +1249,7 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node)
        if (firmware_has_feature(FW_FEATURE_CMO))
                vio_cmo_set_dma_ops(viodev);
        else
-               viodev->dev.archdata.dma_ops = &dma_iommu_ops;
+               set_dma_ops(&viodev->dev, &dma_iommu_ops);
        set_iommu_table_base(&viodev->dev, vio_build_iommu_table(viodev));
        set_dev_node(&viodev->dev, of_node_to_nid(of_node));