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

Liu, Yi L yi.l.liu at intel.com
Tue Feb 14 08:35:33 UTC 2023


> From: Tian, Kevin <kevin.tian at intel.com>
> Sent: Tuesday, February 14, 2023 4:32 PM
> 
> > 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.

Ok. 


More information about the Intel-gfx mailing list