2017-06-28 11:10:27

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH v2] iommu/vt-d: constify intel_dma_ops

Most dma_map_ops structures are never modified. Constify these
structures such that these can be write-protected.

Signed-off-by: Arvind Yadav <[email protected]>
---
Changes in v2:
Added description.

drivers/iommu/intel-iommu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 90ab011..de0df48 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -3970,7 +3970,7 @@ static int intel_mapping_error(struct device *dev, dma_addr_t dma_addr)
return !dma_addr;
}

-struct dma_map_ops intel_dma_ops = {
+const struct dma_map_ops intel_dma_ops = {
.alloc = intel_alloc_coherent,
.free = intel_free_coherent,
.map_sg = intel_map_sg,
--
1.9.1


2017-06-28 12:18:01

by Joerg Roedel

[permalink] [raw]
Subject: Re: [PATCH v2] iommu/vt-d: constify intel_dma_ops

On Wed, Jun 28, 2017 at 04:39:32PM +0530, Arvind Yadav wrote:
> Most dma_map_ops structures are never modified. Constify these
> structures such that these can be write-protected.
>
> Signed-off-by: Arvind Yadav <[email protected]>
> ---
> Changes in v2:
> Added description.
>
> drivers/iommu/intel-iommu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.