2015-11-29 22:14:57

by Julia Lawall

[permalink] [raw]
Subject: [PATCH 0/3] constify mmu_notifier_ops structures

mmu_notifier_ops structures are never modified, so declare them all as
const.

---

drivers/infiniband/core/umem_odp.c | 2 +-
drivers/iommu/amd_iommu_v2.c | 2 +-
drivers/xen/gntdev.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)


2015-11-29 22:15:39

by Julia Lawall

[permalink] [raw]
Subject: [PATCH 1/3] xen/gntdev: constify mmu_notifier_ops structures

This mmu_notifier_ops structure is never modified, so declare it as
const, like the other mmu_notifier_ops structures.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <[email protected]>

---
The patches in this series are independent of each other.

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

diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c
index 2ea0b3b..a27a9a5 100644
--- a/drivers/xen/gntdev.c
+++ b/drivers/xen/gntdev.c
@@ -518,7 +518,7 @@ static void mn_release(struct mmu_notifier *mn,
mutex_unlock(&priv->lock);
}

-static struct mmu_notifier_ops gntdev_mmu_ops = {
+static const struct mmu_notifier_ops gntdev_mmu_ops = {
.release = mn_release,
.invalidate_page = mn_invl_page,
.invalidate_range_start = mn_invl_range_start,

2015-11-29 22:15:33

by Julia Lawall

[permalink] [raw]
Subject: [PATCH 2/3] iommu/amd: constify mmu_notifier_ops structures

This mmu_notifier_ops structure is never modified, so declare it as
const, like the other mmu_notifier_ops structures.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <[email protected]>

---
The patches in this series are independent of each other.

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

diff --git a/drivers/iommu/amd_iommu_v2.c b/drivers/iommu/amd_iommu_v2.c
index d21d4ed..c847f2f 100644
--- a/drivers/iommu/amd_iommu_v2.c
+++ b/drivers/iommu/amd_iommu_v2.c
@@ -432,7 +432,7 @@ static void mn_release(struct mmu_notifier *mn, struct mm_struct *mm)
unbind_pasid(pasid_state);
}

-static struct mmu_notifier_ops iommu_mn = {
+static const struct mmu_notifier_ops iommu_mn = {
.release = mn_release,
.clear_flush_young = mn_clear_flush_young,
.invalidate_page = mn_invalidate_page,

2015-11-29 22:15:11

by Julia Lawall

[permalink] [raw]
Subject: [PATCH 3/3] IB/core: constify mmu_notifier_ops structures

This mmu_notifier_ops structure is never modified, so declare it as
const, like the other mmu_notifier_ops structures.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <[email protected]>

---
The patches in this series are independent of each other.

drivers/infiniband/core/umem_odp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/umem_odp.c b/drivers/infiniband/core/umem_odp.c
index 40becdb..e69bf26 100644
--- a/drivers/infiniband/core/umem_odp.c
+++ b/drivers/infiniband/core/umem_odp.c
@@ -232,7 +232,7 @@ static void ib_umem_notifier_invalidate_range_end(struct mmu_notifier *mn,
ib_ucontext_notifier_end_account(context);
}

-static struct mmu_notifier_ops ib_umem_notifiers = {
+static const struct mmu_notifier_ops ib_umem_notifiers = {
.release = ib_umem_notifier_release,
.invalidate_page = ib_umem_notifier_invalidate_page,
.invalidate_range_start = ib_umem_notifier_invalidate_range_start,

2015-11-30 06:08:12

by Haggai Eran

[permalink] [raw]
Subject: Re: [PATCH 3/3] IB/core: constify mmu_notifier_ops structures

On 30/11/2015 00:02, Julia Lawall wrote:
> This mmu_notifier_ops structure is never modified, so declare it as
> const, like the other mmu_notifier_ops structures.
>
> Done with the help of Coccinelle.
>
> Signed-off-by: Julia Lawall <[email protected]>

Reviewed-by: Haggai Eran <[email protected]>

Thanks,
Haggai

2015-11-30 14:13:45

by David Vrabel

[permalink] [raw]
Subject: Re: [Xen-devel] [PATCH 1/3] xen/gntdev: constify mmu_notifier_ops structures

On 29/11/15 22:02, Julia Lawall wrote:
> This mmu_notifier_ops structure is never modified, so declare it as
> const, like the other mmu_notifier_ops structures.
>
> Done with the help of Coccinelle.

Applied to for-linus-4.5, thanks.

David

2015-12-14 14:45:06

by Joerg Roedel

[permalink] [raw]
Subject: Re: [PATCH 2/3] iommu/amd: constify mmu_notifier_ops structures

On Sun, Nov 29, 2015 at 11:02:50PM +0100, Julia Lawall wrote:
> This mmu_notifier_ops structure is never modified, so declare it as
> const, like the other mmu_notifier_ops structures.
>
> Done with the help of Coccinelle.
>
> Signed-off-by: Julia Lawall <[email protected]>
>
> ---
> The patches in this series are independent of each other.
>
> drivers/iommu/amd_iommu_v2.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.