[Intel-gfx] [PATCH v3 13/15] vfio: Add cdev for vfio_device

Tian, Kevin kevin.tian at intel.com
Tue Feb 14 08:32:20 UTC 2023


> From: Liu, Yi L <yi.l.liu at intel.com>
> Sent: Monday, February 13, 2023 11:14 PM
> 
> +/*
> + * cdev open op. device access via the fd opened by this function
> + * is blocked until .open_device() is called successfully during
> + * BIND_IOMMUFD.
> + */

remove "cdev open op"

> +int vfio_device_fops_open(struct inode *inode, struct file *filep)

vfio_device_fops_cdev_open()

> 
> +static int vfio_device_add(struct vfio_device *device)
> +{
> +	int ret;
> +
> +	if (IS_ENABLED(CONFIG_VFIO_DEVICE_CDEV))
> +		ret = cdev_device_add(&device->cdev, &device->device);
> +	else
> +		ret = device_add(&device->device);
> +	return ret;
> +}
> +
> +static void vfio_device_del(struct vfio_device *device)
> +{
> +	if (IS_ENABLED(CONFIG_VFIO_DEVICE_CDEV))
> +		cdev_device_del(&device->cdev, &device->device);
> +	else
> +		device_del(&device->device);
> +}
> +

move to header file and have CONFIG_VFIO_DEVICE_CDEV
wrapping vfio_device_add/del() directly.


More information about the Intel-gfx mailing list