There will be a bit more things to free than smmu_domain itself. So keep a
simple inline function in the header to share aross files.
Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Acked-by: Balbir Singh <balbirs@nvidia.com>
Reviewed-by: Pranjal Shrivastava <praan@google.com>
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Signed-off-by: Will Deacon <will@kernel.org>
static void arm_smmu_mmu_notifier_free(struct mmu_notifier *mn)
{
- kfree(container_of(mn, struct arm_smmu_domain, mmu_notifier));
+ arm_smmu_domain_free(
+ container_of(mn, struct arm_smmu_domain, mmu_notifier));
}
static const struct mmu_notifier_ops arm_smmu_mmu_notifier_ops = {
err_asid:
xa_erase(&arm_smmu_asid_xa, smmu_domain->cd.asid);
err_free:
- kfree(smmu_domain);
+ arm_smmu_domain_free(smmu_domain);
return ERR_PTR(ret);
}
ida_free(&smmu->vmid_map, cfg->vmid);
}
- kfree(smmu_domain);
+ arm_smmu_domain_free(smmu_domain);
}
static int arm_smmu_domain_finalise_s1(struct arm_smmu_device *smmu,
return &smmu_domain->domain;
err_free:
- kfree(smmu_domain);
+ arm_smmu_domain_free(smmu_domain);
return ERR_PTR(ret);
}
struct arm_smmu_domain *arm_smmu_domain_alloc(void);
+static inline void arm_smmu_domain_free(struct arm_smmu_domain *smmu_domain)
+{
+ kfree(smmu_domain);
+}
+
void arm_smmu_clear_cd(struct arm_smmu_master *master, ioasid_t ssid);
struct arm_smmu_cd *arm_smmu_get_cd_ptr(struct arm_smmu_master *master,
u32 ssid);