Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Matthew Rosato and committed by
Alex Williamson
b0d2d569 2b48f52f

+5 -7
+1 -1
drivers/vfio/group.c
··· 187 187 if (device->open_count == 0) 188 188 vfio_device_group_get_kvm_safe(device); 189 189 190 - ret = vfio_device_open(device, device->group->iommufd, device->kvm); 190 + ret = vfio_device_open(device, device->group->iommufd); 191 191 192 192 if (device->open_count == 0) 193 193 vfio_device_put_kvm(device);
+1 -2
drivers/vfio/vfio.h
··· 18 18 19 19 void vfio_device_put_registration(struct vfio_device *device); 20 20 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); 23 22 void vfio_device_close(struct vfio_device *device, 24 23 struct iommufd_ctx *iommufd); 25 24
+3 -4
drivers/vfio/vfio_main.c
··· 397 397 } 398 398 399 399 static int vfio_device_first_open(struct vfio_device *device, 400 - struct iommufd_ctx *iommufd, struct kvm *kvm) 400 + struct iommufd_ctx *iommufd) 401 401 { 402 402 int ret; 403 403 ··· 444 444 module_put(device->dev->driver->owner); 445 445 } 446 446 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) 449 448 { 450 449 int ret = 0; 451 450 ··· 452 453 453 454 device->open_count++; 454 455 if (device->open_count == 1) { 455 - ret = vfio_device_first_open(device, iommufd, kvm); 456 + ret = vfio_device_first_open(device, iommufd); 456 457 if (ret) 457 458 device->open_count--; 458 459 }