summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorShivaprasad G Bhat <sbhat@linux.ibm.com>2024-02-15 07:52:32 -0600
committerMichael Ellerman <mpe@ellerman.id.au>2024-04-03 14:28:55 +1100
commit5bd31ab5f79eb6e3bdfa0ca0b57650f9d1604062 (patch)
tree6e037a4cca22a9b46be4a9e6d1224b3e372e31ef /arch
parent39cd87c4eb2b893354f3b850f916353f2658ae6f (diff)
downloadlinux-stable-5bd31ab5f79eb6e3bdfa0ca0b57650f9d1604062.tar.gz
linux-stable-5bd31ab5f79eb6e3bdfa0ca0b57650f9d1604062.tar.bz2
linux-stable-5bd31ab5f79eb6e3bdfa0ca0b57650f9d1604062.zip
powerpc/iommu: Refactor spapr_tce_platform_iommu_attach_dev()
The patch makes the iommu_group_get() call only when using it thereby avoiding the unnecessary get & put for domain already being set case. Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/170800513841.2411.13524607664262048895.stgit@linux.ibm.com
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/kernel/iommu.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index 1185efebf032..29a8c8e18585 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -1285,15 +1285,14 @@ spapr_tce_platform_iommu_attach_dev(struct iommu_domain *platform_domain,
struct device *dev)
{
struct iommu_domain *domain = iommu_get_domain_for_dev(dev);
- struct iommu_group *grp = iommu_group_get(dev);
struct iommu_table_group *table_group;
+ struct iommu_group *grp;
/* At first attach the ownership is already set */
- if (!domain) {
- iommu_group_put(grp);
+ if (!domain)
return 0;
- }
+ grp = iommu_group_get(dev);
table_group = iommu_group_get_iommudata(grp);
/*
* The domain being set to PLATFORM from earlier