aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorHiroshi Doyu <hdoyu@nvidia.com>2013-01-24 08:16:57 -0500
committerMarek Szyprowski <m.szyprowski@samsung.com>2013-02-25 09:30:41 -0500
commit6fe367580339a3adf77273d4366652665319bdeb (patch)
tree211fd3d066c016afaac35d1802d7cd09b64a1f73 /arch/arm
parentfab112a394b9cf5e3bf888af6ff5076ba9fa0f06 (diff)
ARM: dma-mapping: Add arm_iommu_detach_device()
A counter part of arm_iommu_attach_device(). Signed-off-by: Hiroshi Doyu <hdoyu@nvidia.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/include/asm/dma-iommu.h1
-rw-r--r--arch/arm/mm/dma-mapping.c25
2 files changed, 26 insertions, 0 deletions
diff --git a/arch/arm/include/asm/dma-iommu.h b/arch/arm/include/asm/dma-iommu.h
index 666d8a8c3a2b..a8c56acc8c98 100644
--- a/arch/arm/include/asm/dma-iommu.h
+++ b/arch/arm/include/asm/dma-iommu.h
@@ -30,6 +30,7 @@ void arm_iommu_release_mapping(struct dma_iommu_mapping *mapping);
30 30
31int arm_iommu_attach_device(struct device *dev, 31int arm_iommu_attach_device(struct device *dev,
32 struct dma_iommu_mapping *mapping); 32 struct dma_iommu_mapping *mapping);
33void arm_iommu_detach_device(struct device *dev);
33 34
34#endif /* __KERNEL__ */ 35#endif /* __KERNEL__ */
35#endif 36#endif
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index d91c4880f559..6563e3872659 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -1848,4 +1848,29 @@ int arm_iommu_attach_device(struct device *dev,
1848 return 0; 1848 return 0;
1849} 1849}
1850 1850
1851/**
1852 * arm_iommu_detach_device
1853 * @dev: valid struct device pointer
1854 *
1855 * Detaches the provided device from a previously attached map.
1856 * This voids the dma operations (dma_map_ops pointer)
1857 */
1858void arm_iommu_detach_device(struct device *dev)
1859{
1860 struct dma_iommu_mapping *mapping;
1861
1862 mapping = to_dma_iommu_mapping(dev);
1863 if (!mapping) {
1864 dev_warn(dev, "Not attached\n");
1865 return;
1866 }
1867
1868 iommu_detach_device(mapping->domain, dev);
1869 kref_put(&mapping->kref, release_iommu_mapping);
1870 mapping = NULL;
1871 set_dma_ops(dev, NULL);
1872
1873 pr_debug("Detached IOMMU controller from %s device.\n", dev_name(dev));
1874}
1875
1851#endif 1876#endif