> From: Liu, Yi L <yi.l....@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.

Reply via email to