linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iommu/arm-smmu-v3: Constify arm_smmu_mmu_notifier_ops
@ 2021-12-04 22:33 Rikard Falkeborn
  2021-12-10  9:54 ` Jean-Philippe Brucker
  2021-12-14 15:18 ` Will Deacon
  0 siblings, 2 replies; 3+ messages in thread
From: Rikard Falkeborn @ 2021-12-04 22:33 UTC (permalink / raw)
  To: Will Deacon, Robin Murphy, Joerg Roedel
  Cc: Jonathan Cameron, Jean-Philippe Brucker, Eric Auger,
	linux-arm-kernel, iommu, linux-kernel, Rikard Falkeborn

The only usage of arm_smmu_mmu_notifier_ops is to assign its address to
the ops field in the mmu_notifier struct, which is a pointer to const
struct mmu_notifier_ops. Make it const to allow the compiler to put it
in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c
index ee66d1f4cb81..a737ba5f727e 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c
@@ -220,7 +220,7 @@ static void arm_smmu_mmu_notifier_free(struct mmu_notifier *mn)
 	kfree(mn_to_smmu(mn));
 }
 
-static struct mmu_notifier_ops arm_smmu_mmu_notifier_ops = {
+static const struct mmu_notifier_ops arm_smmu_mmu_notifier_ops = {
 	.invalidate_range	= arm_smmu_mm_invalidate_range,
 	.release		= arm_smmu_mm_release,
 	.free_notifier		= arm_smmu_mmu_notifier_free,
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] iommu/arm-smmu-v3: Constify arm_smmu_mmu_notifier_ops
  2021-12-04 22:33 [PATCH] iommu/arm-smmu-v3: Constify arm_smmu_mmu_notifier_ops Rikard Falkeborn
@ 2021-12-10  9:54 ` Jean-Philippe Brucker
  2021-12-14 15:18 ` Will Deacon
  1 sibling, 0 replies; 3+ messages in thread
From: Jean-Philippe Brucker @ 2021-12-10  9:54 UTC (permalink / raw)
  To: Rikard Falkeborn
  Cc: Will Deacon, Robin Murphy, Joerg Roedel, Jonathan Cameron,
	Eric Auger, linux-arm-kernel, iommu, linux-kernel

On Sat, Dec 04, 2021 at 11:33:01PM +0100, Rikard Falkeborn wrote:
> The only usage of arm_smmu_mmu_notifier_ops is to assign its address to
> the ops field in the mmu_notifier struct, which is a pointer to const
> struct mmu_notifier_ops. Make it const to allow the compiler to put it
> in read-only memory.
> 
> Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>

Reviewed-by: Jean-Philippe Brucker <jean-philippe@linaro.org>

> ---
>  drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c
> index ee66d1f4cb81..a737ba5f727e 100644
> --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c
> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c
> @@ -220,7 +220,7 @@ static void arm_smmu_mmu_notifier_free(struct mmu_notifier *mn)
>  	kfree(mn_to_smmu(mn));
>  }
>  
> -static struct mmu_notifier_ops arm_smmu_mmu_notifier_ops = {
> +static const struct mmu_notifier_ops arm_smmu_mmu_notifier_ops = {
>  	.invalidate_range	= arm_smmu_mm_invalidate_range,
>  	.release		= arm_smmu_mm_release,
>  	.free_notifier		= arm_smmu_mmu_notifier_free,
> -- 
> 2.34.1
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iommu/arm-smmu-v3: Constify arm_smmu_mmu_notifier_ops
  2021-12-04 22:33 [PATCH] iommu/arm-smmu-v3: Constify arm_smmu_mmu_notifier_ops Rikard Falkeborn
  2021-12-10  9:54 ` Jean-Philippe Brucker
@ 2021-12-14 15:18 ` Will Deacon
  1 sibling, 0 replies; 3+ messages in thread
From: Will Deacon @ 2021-12-14 15:18 UTC (permalink / raw)
  To: Rikard Falkeborn, Robin Murphy, Joerg Roedel
  Cc: catalin.marinas, kernel-team, Will Deacon, linux-kernel,
	linux-arm-kernel, Jonathan Cameron, Eric Auger,
	Jean-Philippe Brucker, iommu

On Sat, 4 Dec 2021 23:33:01 +0100, Rikard Falkeborn wrote:
> The only usage of arm_smmu_mmu_notifier_ops is to assign its address to
> the ops field in the mmu_notifier struct, which is a pointer to const
> struct mmu_notifier_ops. Make it const to allow the compiler to put it
> in read-only memory.
> 
> 

Applied to will (for-joerg/arm-smmu/updates), thanks!

[1/1] iommu/arm-smmu-v3: Constify arm_smmu_mmu_notifier_ops
      https://git.kernel.org/will/c/17d9a4b43b28

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-12-14 15:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-04 22:33 [PATCH] iommu/arm-smmu-v3: Constify arm_smmu_mmu_notifier_ops Rikard Falkeborn
2021-12-10  9:54 ` Jean-Philippe Brucker
2021-12-14 15:18 ` Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).