iommu/mediatek: Constify iommu_ops
authorArvind Yadav <arvind.yadav.cs@gmail.com>
Thu, 18 Oct 2018 11:13:38 +0000 (19:13 +0800)
committerJoerg Roedel <jroedel@suse.de>
Tue, 6 Nov 2018 15:40:29 +0000 (16:40 +0100)
iommu_ops are not supposed to change at runtime.
Functions 'iommu_device_set_ops' and 'bus_set_iommu' working with
const iommu_ops provided by <linux/iommu.h>. So mark the non-const
structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
(Change the title to iommu/mediatek: xx)
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/mtk_iommu.c
drivers/iommu/mtk_iommu_v1.c

index 44bd5b9166bbfd2b6022ae22f20a88eae0058225..d69a9ffa58a4d88cb9d4e286fae97242f8b3dd18 100644 (file)
@@ -113,7 +113,7 @@ struct mtk_iommu_domain {
        struct iommu_domain             domain;
 };
 
-static struct iommu_ops mtk_iommu_ops;
+static const struct iommu_ops mtk_iommu_ops;
 
 static LIST_HEAD(m4ulist);     /* List all the M4U HWs */
 
@@ -488,7 +488,7 @@ static int mtk_iommu_of_xlate(struct device *dev, struct of_phandle_args *args)
        return iommu_fwspec_add_ids(dev, args->args, 1);
 }
 
-static struct iommu_ops mtk_iommu_ops = {
+static const struct iommu_ops mtk_iommu_ops = {
        .domain_alloc   = mtk_iommu_domain_alloc,
        .domain_free    = mtk_iommu_domain_free,
        .attach_dev     = mtk_iommu_attach_device,
index 0e780848f59b6b41bb96859c3539c83e0939d322..27867b862d7ae746ef848eeab3a210d9e112eb7a 100644 (file)
@@ -362,7 +362,7 @@ static phys_addr_t mtk_iommu_iova_to_phys(struct iommu_domain *domain,
        return pa;
 }
 
-static struct iommu_ops mtk_iommu_ops;
+static const struct iommu_ops mtk_iommu_ops;
 
 /*
  * MTK generation one iommu HW only support one iommu domain, and all the client
@@ -524,7 +524,7 @@ static int mtk_iommu_hw_init(const struct mtk_iommu_data *data)
        return 0;
 }
 
-static struct iommu_ops mtk_iommu_ops = {
+static const struct iommu_ops mtk_iommu_ops = {
        .domain_alloc   = mtk_iommu_domain_alloc,
        .domain_free    = mtk_iommu_domain_free,
        .attach_dev     = mtk_iommu_attach_device,