diff mbox series

[08/14] vfio: remove unused method from vfio_iommu_driver_ops

Message ID 20210825161916.50393-9-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [01/14] vfio: Move vfio_iommu_group_get() to vfio_register_group_dev() | expand

Commit Message

Christoph Hellwig Aug. 25, 2021, 4:19 p.m. UTC
The read, write and mmap methods are never implemented, so remove them.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
---
 drivers/vfio/vfio.c  | 50 --------------------------------------------
 include/linux/vfio.h |  5 -----
 2 files changed, 55 deletions(-)

Comments

Tian, Kevin Aug. 26, 2021, 3:11 a.m. UTC | #1
> From: Christoph Hellwig <hch@lst.de>
> Sent: Thursday, August 26, 2021 12:19 AM
> 
> The read, write and mmap methods are never implemented, so remove
> them.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>

Reviewed-by: Kevin Tian <kevin.tian@intel.com>

> ---
>  drivers/vfio/vfio.c  | 50 --------------------------------------------
>  include/linux/vfio.h |  5 -----
>  2 files changed, 55 deletions(-)
> 
> diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
> index 6bdfcb9264458c..7b9629cbbf0e80 100644
> --- a/drivers/vfio/vfio.c
> +++ b/drivers/vfio/vfio.c
> @@ -1252,62 +1252,12 @@ static int vfio_fops_release(struct inode *inode,
> struct file *filep)
>  	return 0;
>  }
> 
> -/*
> - * Once an iommu driver is set, we optionally pass read/write/mmap
> - * on to the driver, allowing management interfaces beyond ioctl.
> - */
> -static ssize_t vfio_fops_read(struct file *filep, char __user *buf,
> -			      size_t count, loff_t *ppos)
> -{
> -	struct vfio_container *container = filep->private_data;
> -	struct vfio_iommu_driver *driver;
> -	ssize_t ret = -EINVAL;
> -
> -	driver = container->iommu_driver;
> -	if (likely(driver && driver->ops->read))
> -		ret = driver->ops->read(container->iommu_data,
> -					buf, count, ppos);
> -
> -	return ret;
> -}
> -
> -static ssize_t vfio_fops_write(struct file *filep, const char __user *buf,
> -			       size_t count, loff_t *ppos)
> -{
> -	struct vfio_container *container = filep->private_data;
> -	struct vfio_iommu_driver *driver;
> -	ssize_t ret = -EINVAL;
> -
> -	driver = container->iommu_driver;
> -	if (likely(driver && driver->ops->write))
> -		ret = driver->ops->write(container->iommu_data,
> -					 buf, count, ppos);
> -
> -	return ret;
> -}
> -
> -static int vfio_fops_mmap(struct file *filep, struct vm_area_struct *vma)
> -{
> -	struct vfio_container *container = filep->private_data;
> -	struct vfio_iommu_driver *driver;
> -	int ret = -EINVAL;
> -
> -	driver = container->iommu_driver;
> -	if (likely(driver && driver->ops->mmap))
> -		ret = driver->ops->mmap(container->iommu_data, vma);
> -
> -	return ret;
> -}
> -
>  static const struct file_operations vfio_fops = {
>  	.owner		= THIS_MODULE,
>  	.open		= vfio_fops_open,
>  	.release	= vfio_fops_release,
> -	.read		= vfio_fops_read,
> -	.write		= vfio_fops_write,
>  	.unlocked_ioctl	= vfio_fops_unl_ioctl,
>  	.compat_ioctl	= compat_ptr_ioctl,
> -	.mmap		= vfio_fops_mmap,
>  };
> 
>  /**
> diff --git a/include/linux/vfio.h b/include/linux/vfio.h
> index bbe29300862649..7a57a0077f9637 100644
> --- a/include/linux/vfio.h
> +++ b/include/linux/vfio.h
> @@ -95,13 +95,8 @@ struct vfio_iommu_driver_ops {
>  	struct module	*owner;
>  	void		*(*open)(unsigned long arg);
>  	void		(*release)(void *iommu_data);
> -	ssize_t		(*read)(void *iommu_data, char __user *buf,
> -				size_t count, loff_t *ppos);
> -	ssize_t		(*write)(void *iommu_data, const char __user *buf,
> -				 size_t count, loff_t *size);
>  	long		(*ioctl)(void *iommu_data, unsigned int cmd,
>  				 unsigned long arg);
> -	int		(*mmap)(void *iommu_data, struct vm_area_struct
> *vma);
>  	int		(*attach_group)(void *iommu_data,
>  					struct iommu_group *group);
>  	void		(*detach_group)(void *iommu_data,
> --
> 2.30.2
diff mbox series

Patch

diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
index 6bdfcb9264458c..7b9629cbbf0e80 100644
--- a/drivers/vfio/vfio.c
+++ b/drivers/vfio/vfio.c
@@ -1252,62 +1252,12 @@  static int vfio_fops_release(struct inode *inode, struct file *filep)
 	return 0;
 }
 
-/*
- * Once an iommu driver is set, we optionally pass read/write/mmap
- * on to the driver, allowing management interfaces beyond ioctl.
- */
-static ssize_t vfio_fops_read(struct file *filep, char __user *buf,
-			      size_t count, loff_t *ppos)
-{
-	struct vfio_container *container = filep->private_data;
-	struct vfio_iommu_driver *driver;
-	ssize_t ret = -EINVAL;
-
-	driver = container->iommu_driver;
-	if (likely(driver && driver->ops->read))
-		ret = driver->ops->read(container->iommu_data,
-					buf, count, ppos);
-
-	return ret;
-}
-
-static ssize_t vfio_fops_write(struct file *filep, const char __user *buf,
-			       size_t count, loff_t *ppos)
-{
-	struct vfio_container *container = filep->private_data;
-	struct vfio_iommu_driver *driver;
-	ssize_t ret = -EINVAL;
-
-	driver = container->iommu_driver;
-	if (likely(driver && driver->ops->write))
-		ret = driver->ops->write(container->iommu_data,
-					 buf, count, ppos);
-
-	return ret;
-}
-
-static int vfio_fops_mmap(struct file *filep, struct vm_area_struct *vma)
-{
-	struct vfio_container *container = filep->private_data;
-	struct vfio_iommu_driver *driver;
-	int ret = -EINVAL;
-
-	driver = container->iommu_driver;
-	if (likely(driver && driver->ops->mmap))
-		ret = driver->ops->mmap(container->iommu_data, vma);
-
-	return ret;
-}
-
 static const struct file_operations vfio_fops = {
 	.owner		= THIS_MODULE,
 	.open		= vfio_fops_open,
 	.release	= vfio_fops_release,
-	.read		= vfio_fops_read,
-	.write		= vfio_fops_write,
 	.unlocked_ioctl	= vfio_fops_unl_ioctl,
 	.compat_ioctl	= compat_ptr_ioctl,
-	.mmap		= vfio_fops_mmap,
 };
 
 /**
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index bbe29300862649..7a57a0077f9637 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -95,13 +95,8 @@  struct vfio_iommu_driver_ops {
 	struct module	*owner;
 	void		*(*open)(unsigned long arg);
 	void		(*release)(void *iommu_data);
-	ssize_t		(*read)(void *iommu_data, char __user *buf,
-				size_t count, loff_t *ppos);
-	ssize_t		(*write)(void *iommu_data, const char __user *buf,
-				 size_t count, loff_t *size);
 	long		(*ioctl)(void *iommu_data, unsigned int cmd,
 				 unsigned long arg);
-	int		(*mmap)(void *iommu_data, struct vm_area_struct *vma);
 	int		(*attach_group)(void *iommu_data,
 					struct iommu_group *group);
 	void		(*detach_group)(void *iommu_data,