summaryrefslogtreecommitdiff
path: root/drivers/vfio/container.c
diff options
context:
space:
mode:
authorJason Gunthorpe <jgg@nvidia.com>2022-11-29 23:31:48 +0300
committerJason Gunthorpe <jgg@nvidia.com>2022-12-02 18:52:03 +0300
commit04f930c3e44bb9010bba8521f970d00d95a94eb0 (patch)
tree96c40b89fa8e1d7c29db8be3212262bd1425cf1e /drivers/vfio/container.c
parentbab6fabc01d99c7e0293807e835231740379b692 (diff)
downloadlinux-04f930c3e44bb9010bba8521f970d00d95a94eb0.tar.xz
vfio: Rename vfio_device_assign/unassign_container()
These functions don't really assign anything anymore, they just increment some refcounts and do a sanity check. Call them vfio_group_[un]use_container() Link: https://lore.kernel.org/r/3-v4-42cd2eb0e3eb+335a-vfio_iommufd_jgg@nvidia.com Reviewed-by: Kevin Tian <kevin.tian@intel.com> Reviewed-by: Yi Liu <yi.l.liu@intel.com> Reviewed-by: Alex Williamson <alex.williamson@redhat.com> Tested-by: Alex Williamson <alex.williamson@redhat.com> Tested-by: Nicolin Chen <nicolinc@nvidia.com> Tested-by: Yi Liu <yi.l.liu@intel.com> Tested-by: Lixiao Yang <lixiao.yang@intel.com> Tested-by: Matthew Rosato <mjrosato@linux.ibm.com> Tested-by: Yu He <yu.he@intel.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'drivers/vfio/container.c')
-rw-r--r--drivers/vfio/container.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/vfio/container.c b/drivers/vfio/container.c
index dd79a66ec62c..499777930b08 100644
--- a/drivers/vfio/container.c
+++ b/drivers/vfio/container.c
@@ -511,10 +511,8 @@ void vfio_group_detach_container(struct vfio_group *group)
vfio_container_put(container);
}
-int vfio_device_assign_container(struct vfio_device *device)
+int vfio_group_use_container(struct vfio_group *group)
{
- struct vfio_group *group = device->group;
-
lockdep_assert_held(&group->group_lock);
if (!group->container || !group->container->iommu_driver ||
@@ -529,13 +527,13 @@ int vfio_device_assign_container(struct vfio_device *device)
return 0;
}
-void vfio_device_unassign_container(struct vfio_device *device)
+void vfio_group_unuse_container(struct vfio_group *group)
{
- lockdep_assert_held_write(&device->group->group_lock);
+ lockdep_assert_held(&group->group_lock);
- WARN_ON(device->group->container_users <= 1);
- device->group->container_users--;
- fput(device->group->opened_file);
+ WARN_ON(group->container_users <= 1);
+ group->container_users--;
+ fput(group->opened_file);
}
/*