Commit eb24c100 authored by Jason Gunthorpe's avatar Jason Gunthorpe Committed by Alex Williamson

vfio: Remove struct vfio_device_ops open/release

Nothing uses this anymore, delete it.
Signed-off-by: default avatarYishai Hadas <yishaih@nvidia.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
Reviewed-by: default avatarCornelia Huck <cohuck@redhat.com>
Link: https://lore.kernel.org/r/14-v4-9ea22c5e6afb+1adf-vfio_reflck_jgg@nvidia.comSigned-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
parent dd574d9b
...@@ -37,26 +37,6 @@ static void vfio_mdev_close_device(struct vfio_device *core_vdev) ...@@ -37,26 +37,6 @@ static void vfio_mdev_close_device(struct vfio_device *core_vdev)
parent->ops->close_device(mdev); parent->ops->close_device(mdev);
} }
static int vfio_mdev_open(struct vfio_device *core_vdev)
{
struct mdev_device *mdev = to_mdev_device(core_vdev->dev);
struct mdev_parent *parent = mdev->type->parent;
if (unlikely(!parent->ops->open))
return 0;
return parent->ops->open(mdev);
}
static void vfio_mdev_release(struct vfio_device *core_vdev)
{
struct mdev_device *mdev = to_mdev_device(core_vdev->dev);
struct mdev_parent *parent = mdev->type->parent;
if (likely(parent->ops->release))
parent->ops->release(mdev);
}
static long vfio_mdev_unlocked_ioctl(struct vfio_device *core_vdev, static long vfio_mdev_unlocked_ioctl(struct vfio_device *core_vdev,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
...@@ -122,8 +102,6 @@ static const struct vfio_device_ops vfio_mdev_dev_ops = { ...@@ -122,8 +102,6 @@ static const struct vfio_device_ops vfio_mdev_dev_ops = {
.name = "vfio-mdev", .name = "vfio-mdev",
.open_device = vfio_mdev_open_device, .open_device = vfio_mdev_open_device,
.close_device = vfio_mdev_close_device, .close_device = vfio_mdev_close_device,
.open = vfio_mdev_open,
.release = vfio_mdev_release,
.ioctl = vfio_mdev_unlocked_ioctl, .ioctl = vfio_mdev_unlocked_ioctl,
.read = vfio_mdev_read, .read = vfio_mdev_read,
.write = vfio_mdev_write, .write = vfio_mdev_write,
......
...@@ -1470,19 +1470,13 @@ static int vfio_group_get_device_fd(struct vfio_group *group, char *buf) ...@@ -1470,19 +1470,13 @@ static int vfio_group_get_device_fd(struct vfio_group *group, char *buf)
} }
mutex_unlock(&device->dev_set->lock); mutex_unlock(&device->dev_set->lock);
if (device->ops->open) {
ret = device->ops->open(device);
if (ret)
goto err_close_device;
}
/* /*
* We can't use anon_inode_getfd() because we need to modify * We can't use anon_inode_getfd() because we need to modify
* the f_mode flags directly to allow more than just ioctls * the f_mode flags directly to allow more than just ioctls
*/ */
fdno = ret = get_unused_fd_flags(O_CLOEXEC); fdno = ret = get_unused_fd_flags(O_CLOEXEC);
if (ret < 0) if (ret < 0)
goto err_release; goto err_close_device;
filep = anon_inode_getfile("[vfio-device]", &vfio_device_fops, filep = anon_inode_getfile("[vfio-device]", &vfio_device_fops,
device, O_RDWR); device, O_RDWR);
...@@ -1509,9 +1503,6 @@ static int vfio_group_get_device_fd(struct vfio_group *group, char *buf) ...@@ -1509,9 +1503,6 @@ static int vfio_group_get_device_fd(struct vfio_group *group, char *buf)
err_fd: err_fd:
put_unused_fd(fdno); put_unused_fd(fdno);
err_release:
if (device->ops->release)
device->ops->release(device);
err_close_device: err_close_device:
mutex_lock(&device->dev_set->lock); mutex_lock(&device->dev_set->lock);
if (device->open_count == 1 && device->ops->close_device) if (device->open_count == 1 && device->ops->close_device)
...@@ -1659,9 +1650,6 @@ static int vfio_device_fops_release(struct inode *inode, struct file *filep) ...@@ -1659,9 +1650,6 @@ static int vfio_device_fops_release(struct inode *inode, struct file *filep)
{ {
struct vfio_device *device = filep->private_data; struct vfio_device *device = filep->private_data;
if (device->ops->release)
device->ops->release(device);
mutex_lock(&device->dev_set->lock); mutex_lock(&device->dev_set->lock);
if (!--device->open_count && device->ops->close_device) if (!--device->open_count && device->ops->close_device)
device->ops->close_device(device); device->ops->close_device(device);
......
...@@ -72,11 +72,6 @@ struct device *mtype_get_parent_dev(struct mdev_type *mtype); ...@@ -72,11 +72,6 @@ struct device *mtype_get_parent_dev(struct mdev_type *mtype);
* @mdev: mdev_device device structure which is being * @mdev: mdev_device device structure which is being
* destroyed * destroyed
* Returns integer: success (0) or error (< 0) * Returns integer: success (0) or error (< 0)
* @open: Open mediated device.
* @mdev: mediated device.
* Returns integer: success (0) or error (< 0)
* @release: release mediated device
* @mdev: mediated device.
* @read: Read emulation callback * @read: Read emulation callback
* @mdev: mediated device structure * @mdev: mediated device structure
* @buf: read buffer * @buf: read buffer
...@@ -113,8 +108,6 @@ struct mdev_parent_ops { ...@@ -113,8 +108,6 @@ struct mdev_parent_ops {
int (*remove)(struct mdev_device *mdev); int (*remove)(struct mdev_device *mdev);
int (*open_device)(struct mdev_device *mdev); int (*open_device)(struct mdev_device *mdev);
void (*close_device)(struct mdev_device *mdev); void (*close_device)(struct mdev_device *mdev);
int (*open)(struct mdev_device *mdev);
void (*release)(struct mdev_device *mdev);
ssize_t (*read)(struct mdev_device *mdev, char __user *buf, ssize_t (*read)(struct mdev_device *mdev, char __user *buf,
size_t count, loff_t *ppos); size_t count, loff_t *ppos);
ssize_t (*write)(struct mdev_device *mdev, const char __user *buf, ssize_t (*write)(struct mdev_device *mdev, const char __user *buf,
......
...@@ -46,8 +46,6 @@ struct vfio_device { ...@@ -46,8 +46,6 @@ struct vfio_device {
* *
* @open_device: Called when the first file descriptor is opened for this device * @open_device: Called when the first file descriptor is opened for this device
* @close_device: Opposite of open_device * @close_device: Opposite of open_device
* @open: Called when userspace creates new file descriptor for device
* @release: Called when userspace releases file descriptor for device
* @read: Perform read(2) on device file descriptor * @read: Perform read(2) on device file descriptor
* @write: Perform write(2) on device file descriptor * @write: Perform write(2) on device file descriptor
* @ioctl: Perform ioctl(2) on device file descriptor, supporting VFIO_DEVICE_* * @ioctl: Perform ioctl(2) on device file descriptor, supporting VFIO_DEVICE_*
...@@ -62,8 +60,6 @@ struct vfio_device_ops { ...@@ -62,8 +60,6 @@ struct vfio_device_ops {
char *name; char *name;
int (*open_device)(struct vfio_device *vdev); int (*open_device)(struct vfio_device *vdev);
void (*close_device)(struct vfio_device *vdev); void (*close_device)(struct vfio_device *vdev);
int (*open)(struct vfio_device *vdev);
void (*release)(struct vfio_device *vdev);
ssize_t (*read)(struct vfio_device *vdev, char __user *buf, ssize_t (*read)(struct vfio_device *vdev, char __user *buf,
size_t count, loff_t *ppos); size_t count, loff_t *ppos);
ssize_t (*write)(struct vfio_device *vdev, const char __user *buf, ssize_t (*write)(struct vfio_device *vdev, const char __user *buf,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment