Skip to content

Commit b0d2d56

Browse files
rosatomjAlex Williamson
authored andcommitted
vfio: no need to pass kvm pointer during device open
Nothing uses this value during vfio_device_open anymore so it's safe to remove it. Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com> Tested-by: Tony Krowiak <akrowiak@linux.ibm.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Reviewed-by: Yi Liu <yi.l.liu@intel.com> Link: https://lore.kernel.org/r/20230203215027.151988-3-mjrosato@linux.ibm.com Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
1 parent 2b48f52 commit b0d2d56

3 files changed

Lines changed: 5 additions & 7 deletions

File tree

drivers/vfio/group.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ static int vfio_device_group_open(struct vfio_device *device)
187187
if (device->open_count == 0)
188188
vfio_device_group_get_kvm_safe(device);
189189

190-
ret = vfio_device_open(device, device->group->iommufd, device->kvm);
190+
ret = vfio_device_open(device, device->group->iommufd);
191191

192192
if (device->open_count == 0)
193193
vfio_device_put_kvm(device);

drivers/vfio/vfio.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ struct vfio_container;
1818

1919
void vfio_device_put_registration(struct vfio_device *device);
2020
bool vfio_device_try_get_registration(struct vfio_device *device);
21-
int vfio_device_open(struct vfio_device *device,
22-
struct iommufd_ctx *iommufd, struct kvm *kvm);
21+
int vfio_device_open(struct vfio_device *device, struct iommufd_ctx *iommufd);
2322
void vfio_device_close(struct vfio_device *device,
2423
struct iommufd_ctx *iommufd);
2524

drivers/vfio/vfio_main.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ static bool vfio_assert_device_open(struct vfio_device *device)
397397
}
398398

399399
static int vfio_device_first_open(struct vfio_device *device,
400-
struct iommufd_ctx *iommufd, struct kvm *kvm)
400+
struct iommufd_ctx *iommufd)
401401
{
402402
int ret;
403403

@@ -444,16 +444,15 @@ static void vfio_device_last_close(struct vfio_device *device,
444444
module_put(device->dev->driver->owner);
445445
}
446446

447-
int vfio_device_open(struct vfio_device *device,
448-
struct iommufd_ctx *iommufd, struct kvm *kvm)
447+
int vfio_device_open(struct vfio_device *device, struct iommufd_ctx *iommufd)
449448
{
450449
int ret = 0;
451450

452451
lockdep_assert_held(&device->dev_set->lock);
453452

454453
device->open_count++;
455454
if (device->open_count == 1) {
456-
ret = vfio_device_first_open(device, iommufd, kvm);
455+
ret = vfio_device_first_open(device, iommufd);
457456
if (ret)
458457
device->open_count--;
459458
}

0 commit comments

Comments
 (0)