On 2/1/23 11:10 PM, Tian, Kevin wrote: >> From: Alex Williamson <alex.william...@redhat.com> >> Sent: Thursday, February 2, 2023 7:28 AM >>> >>> +#ifdef CONFIG_HAVE_KVM >>> +static bool vfio_kvm_get_kvm_safe(struct vfio_device *device, struct kvm >> *kvm) >> >> I'm tempted to name these vfio_device_get_kvm_safe() and only pass the >> vfio_device, where of course we can get the kvm pointer from the group >> internally. >> > > I have a different thought. In the end the cdev series also need the similar > safe get/put logic then it's better to keep it in vfio_main.c called by > the group/cdev path individually.
Ah, I hadn't considered the cdev series - OK, I can move the functions back into vfio_main and externalize both via drivers/vfio/vfio.h so they can be called from group.c for this fix and then available to vfio_main.c already for cdev.