[Intel-gfx] [PATCH v2 12/14] vfio: Add cdev for vfio_device
Tian, Kevin
kevin.tian at intel.com
Tue Feb 7 07:54:06 UTC 2023
> From: Liu, Yi L <yi.l.liu at intel.com>
> Sent: Monday, February 6, 2023 5:06 PM
> +
> +static struct vfio {
> + dev_t device_devt;
> +} vfio;
the structure is meaningless.
> +int vfio_device_fops_open(struct inode *inode, struct file *filep)
> +{
> + struct vfio_device *device = container_of(inode->i_cdev,
> + struct vfio_device, cdev);
> + struct vfio_device_file *df;
> + int ret;
> +
> + if (!vfio_device_try_get_registration(device))
> + return -ENODEV;
> +
> + /*
> + * device access is blocked until .open_device() is called
> + * in BIND_IOMMUFD.
> + */
this comment is more related to the whole function instead of the
following allocation code. Move it to be the function comment.
> @@ -51,6 +52,7 @@ struct vfio_device {
> /* Members below here are private, not for driver use */
> unsigned int index;
> struct device device; /* device.kref covers object life circle */
> + struct cdev cdev;
only if CDEV is configured.
More information about the Intel-gfx
mailing list