/*
* 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);
ret = -EBUSY;
goto out_unlock;
}
- __vfio_group_unset_container(group);
+ vfio_group_detach_container(group);
out_unlock:
up_write(&group->group_rwsem);
* 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);