2017-08-28 12:12:32

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 1/3] iommu: exynos: constify iommu_ops

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 <[email protected]>
---
drivers/iommu/exynos-iommu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
index 2395478..a540016 100644
--- a/drivers/iommu/exynos-iommu.c
+++ b/drivers/iommu/exynos-iommu.c
@@ -569,7 +569,7 @@ static void sysmmu_tlb_invalidate_entry(struct sysmmu_drvdata *data,
spin_unlock_irqrestore(&data->lock, flags);
}

-static struct iommu_ops exynos_iommu_ops;
+static const struct iommu_ops exynos_iommu_ops;

static int __init exynos_sysmmu_probe(struct platform_device *pdev)
{
@@ -1323,7 +1323,7 @@ static int exynos_iommu_of_xlate(struct device *dev,
return 0;
}

-static struct iommu_ops exynos_iommu_ops = {
+static const struct iommu_ops exynos_iommu_ops = {
.domain_alloc = exynos_iommu_domain_alloc,
.domain_free = exynos_iommu_domain_free,
.attach_dev = exynos_iommu_attach_device,
--
1.9.1


2017-08-28 13:13:50

by Marek Szyprowski

[permalink] [raw]
Subject: Re: [PATCH 1/3] iommu: exynos: constify iommu_ops

Hi Arvind,

On 2017-08-28 14:12, Arvind Yadav wrote:
> 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 <[email protected]>

Acked-by: Marek Szyprowski <[email protected]>

I remember that in the past there were a reason for non-const iommu_ops
in the
IOMMU API, but I hope it has been finally resolved.

> ---
> drivers/iommu/exynos-iommu.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
> index 2395478..a540016 100644
> --- a/drivers/iommu/exynos-iommu.c
> +++ b/drivers/iommu/exynos-iommu.c
> @@ -569,7 +569,7 @@ static void sysmmu_tlb_invalidate_entry(struct sysmmu_drvdata *data,
> spin_unlock_irqrestore(&data->lock, flags);
> }
>
> -static struct iommu_ops exynos_iommu_ops;
> +static const struct iommu_ops exynos_iommu_ops;
>
> static int __init exynos_sysmmu_probe(struct platform_device *pdev)
> {
> @@ -1323,7 +1323,7 @@ static int exynos_iommu_of_xlate(struct device *dev,
> return 0;
> }
>
> -static struct iommu_ops exynos_iommu_ops = {
> +static const struct iommu_ops exynos_iommu_ops = {
> .domain_alloc = exynos_iommu_domain_alloc,
> .domain_free = exynos_iommu_domain_free,
> .attach_dev = exynos_iommu_attach_device,

Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland

2017-08-30 13:14:29

by Joerg Roedel

[permalink] [raw]
Subject: Re: [PATCH 1/3] iommu: exynos: constify iommu_ops

On Mon, Aug 28, 2017 at 05:42:05PM +0530, Arvind Yadav wrote:
> 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 <[email protected]>
> ---
> drivers/iommu/exynos-iommu.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)

Applied, thanks.