Skip to content

Commit

Permalink
vfio: More vfio_file_is_group() use cases
Browse files Browse the repository at this point in the history
Replace further open coded tests with helper.

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/166516896843.1215571.5378890510536477434.stgit@omen
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
  • Loading branch information
Alex Williamson committed Oct 7, 2022
1 parent 3dd59a7 commit b1b8132
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/vfio/vfio_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1615,7 +1615,7 @@ bool vfio_file_enforced_coherent(struct file *file)
struct vfio_group *group = file->private_data;
bool ret;

if (file->f_op != &vfio_group_fops)
if (!vfio_file_is_group(file))
return true;

mutex_lock(&group->group_lock);
Expand Down Expand Up @@ -1647,7 +1647,7 @@ void vfio_file_set_kvm(struct file *file, struct kvm *kvm)
{
struct vfio_group *group = file->private_data;

if (file->f_op != &vfio_group_fops)
if (!vfio_file_is_group(file))
return;

mutex_lock(&group->group_lock);
Expand All @@ -1667,7 +1667,7 @@ bool vfio_file_has_dev(struct file *file, struct vfio_device *device)
{
struct vfio_group *group = file->private_data;

if (file->f_op != &vfio_group_fops)
if (!vfio_file_is_group(file))
return false;

return group == device->group;
Expand Down

0 comments on commit b1b8132

Please sign in to comment.