Commit 6fe36758 authored by Hiroshi Doyu's avatar Hiroshi Doyu Committed by Marek Szyprowski

ARM: dma-mapping: Add arm_iommu_detach_device()

A counter part of arm_iommu_attach_device().
Signed-off-by: default avatarHiroshi Doyu <hdoyu@nvidia.com>
Signed-off-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
parent fab112a3
...@@ -30,6 +30,7 @@ void arm_iommu_release_mapping(struct dma_iommu_mapping *mapping); ...@@ -30,6 +30,7 @@ void arm_iommu_release_mapping(struct dma_iommu_mapping *mapping);
int arm_iommu_attach_device(struct device *dev, int arm_iommu_attach_device(struct device *dev,
struct dma_iommu_mapping *mapping); struct dma_iommu_mapping *mapping);
void arm_iommu_detach_device(struct device *dev);
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif #endif
...@@ -1848,4 +1848,29 @@ int arm_iommu_attach_device(struct device *dev, ...@@ -1848,4 +1848,29 @@ int arm_iommu_attach_device(struct device *dev,
return 0; return 0;
} }
/**
* arm_iommu_detach_device
* @dev: valid struct device pointer
*
* Detaches the provided device from a previously attached map.
* This voids the dma operations (dma_map_ops pointer)
*/
void arm_iommu_detach_device(struct device *dev)
{
struct dma_iommu_mapping *mapping;
mapping = to_dma_iommu_mapping(dev);
if (!mapping) {
dev_warn(dev, "Not attached\n");
return;
}
iommu_detach_device(mapping->domain, dev);
kref_put(&mapping->kref, release_iommu_mapping);
mapping = NULL;
set_dma_ops(dev, NULL);
pr_debug("Detached IOMMU controller from %s device.\n", dev_name(dev));
}
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment