[PATCH 02/11] iommu: Use iommu_group_ref_get/put() for dev->iommu_group

Jason Gunthorpe
2023-04-19T16:12:41Z

No reason to open code this, use the proper helper functions.

Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
drivers/iommu/iommu.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index c486e648402d5c..73e9f50fba9dd2 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -496,7 +496,7 @@ static void __iommu_group_release_device(struct iommu_group *group,
kfree(grp_dev->name);
kfree(grp_dev);
dev->iommu_group = NULL;
- kobject_put(group->devices_kobj);
+ iommu_group_put(group);
}

static void iommu_release_device(struct device *dev)
@@ -1063,8 +1063,7 @@ int iommu_group_add_device(struct iommu_group *group, struct device *dev)
goto err_free_name;
}

- kobject_get(group->devices_kobj);
-
+ iommu_group_ref_get(group);
dev->iommu_group = group;

mutex_lock(&group->mutex);
--
2.40.0