lkml.org 
[lkml]   [2023]   [Feb]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH v2 12/14] vfio: Add cdev for vfio_device
Date
> From: Liu, Yi L <yi.l.liu@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.

\
 
 \ /
  Last update: 2023-03-27 00:12    [W:1.992 / U:0.336 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site