[PATCH v7 10/14] iommu/arm-smmu-v3: Put the SVA mmu notifier in the smmu_domain

Nicolin Chen nicolinc at nvidia.com
Fri May 17 13:34:56 PDT 2024


On Fri, May 17, 2024 at 04:48:14PM -0300, Jason Gunthorpe wrote:
> On Mon, May 13, 2024 at 02:23:18PM -0700, Nicolin Chen wrote:
> > >  static void arm_smmu_mmu_notifier_free(struct mmu_notifier *mn)
> > >  {
> > > -	kfree(mn_to_smmu(mn));
> > > +	struct arm_smmu_domain *smmu_domain =
> > > +		container_of(mn, struct arm_smmu_domain, mmu_notifier);
> > > +
> > > +	kfree(smmu_domain);
> > 
> > Would it be cleaner to refactor mn_to_smmu to mn_to_smmu_domain?
> 
> I usually like a few more usages before making macros..

Hmm, asking because I saw three of them in the end:
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c:145:            container_of(mn, struct arm_smmu_domain, mmu_notifier);
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c:166:            container_of(mn, struct arm_smmu_domain, mmu_notifier);
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c:201:            container_of(mn, struct arm_smmu_domain, mmu_notifier);

How many more usages typically could be a good threshold?

It's a nit though. So, in either way it's fine.

Thanks
Nicolin



More information about the linux-arm-kernel mailing list