diff options
author | Jason Gunthorpe <jgg@nvidia.com> | 2022-09-22 16:20:20 -0300 |
---|---|---|
committer | Alex Williamson <alex.williamson@redhat.com> | 2022-09-22 15:46:06 -0600 |
commit | 429a781c8e01c24ebb2b9da0a63a14e6fd9e0837 (patch) | |
tree | e9b40bcfd1b4b53181f3c8d94bf61540878f3b48 /drivers/vfio | |
parent | vfio: Add header guards and includes to drivers/vfio/vfio.h (diff) | |
download | wireguard-linux-429a781c8e01c24ebb2b9da0a63a14e6fd9e0837.tar.xz wireguard-linux-429a781c8e01c24ebb2b9da0a63a14e6fd9e0837.zip |
vfio: Rename __vfio_group_unset_container()
To vfio_group_detach_container(). This function is really a container
function.
Fold the WARN_ON() into it as a precondition assertion.
A following patch will move the vfio_container functions to their own .c
file.
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/2-v3-297af71838d2+b9-vfio_container_split_jgg@nvidia.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'drivers/vfio')
-rw-r--r-- | drivers/vfio/vfio_main.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c index f9d10dbcf3e6..3d8813125358 100644 --- a/drivers/vfio/vfio_main.c +++ b/drivers/vfio/vfio_main.c @@ -1036,12 +1036,13 @@ static const struct file_operations vfio_fops = { /* * VFIO Group fd, /dev/vfio/$GROUP */ -static void __vfio_group_unset_container(struct vfio_group *group) +static void vfio_group_detach_container(struct vfio_group *group) { struct vfio_container *container = group->container; struct vfio_iommu_driver *driver; lockdep_assert_held_write(&group->group_rwsem); + WARN_ON(group->container_users != 1); down_write(&container->group_lock); @@ -1089,7 +1090,7 @@ static int vfio_group_ioctl_unset_container(struct vfio_group *group) ret = -EBUSY; goto out_unlock; } - __vfio_group_unset_container(group); + vfio_group_detach_container(group); out_unlock: up_write(&group->group_rwsem); @@ -1441,10 +1442,8 @@ static int vfio_group_fops_release(struct inode *inode, struct file *filep) * is only called when there are no open devices. */ WARN_ON(group->notifier.head); - if (group->container) { - WARN_ON(group->container_users != 1); - __vfio_group_unset_container(group); - } + if (group->container) + vfio_group_detach_container(group); group->opened_file = NULL; up_write(&group->group_rwsem); |