Skip to content

Commit 5bd31ab

Browse files
ShivaprasadGBhatmpe
authored andcommitted
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
1 parent 39cd87c commit 5bd31ab

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

arch/powerpc/kernel/iommu.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,15 +1285,14 @@ spapr_tce_platform_iommu_attach_dev(struct iommu_domain *platform_domain,
12851285
struct device *dev)
12861286
{
12871287
struct iommu_domain *domain = iommu_get_domain_for_dev(dev);
1288-
struct iommu_group *grp = iommu_group_get(dev);
12891288
struct iommu_table_group *table_group;
1289+
struct iommu_group *grp;
12901290

12911291
/* At first attach the ownership is already set */
1292-
if (!domain) {
1293-
iommu_group_put(grp);
1292+
if (!domain)
12941293
return 0;
1295-
}
12961294

1295+
grp = iommu_group_get(dev);
12971296
table_group = iommu_group_get_iommudata(grp);
12981297
/*
12991298
* The domain being set to PLATFORM from earlier

0 commit comments

Comments
 (0)