Skip to content

Commit eb24c10

Browse files
jgunthorpeAlex Williamson
authored andcommitted
vfio: Remove struct vfio_device_ops open/release
Nothing uses this anymore, delete it. Signed-off-by: Yishai Hadas <yishaih@nvidia.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Link: https://lore.kernel.org/r/14-v4-9ea22c5e6afb+1adf-vfio_reflck_jgg@nvidia.com Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
1 parent dd574d9 commit eb24c10

4 files changed

Lines changed: 1 addition & 46 deletions

File tree

drivers/vfio/mdev/vfio_mdev.c

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -37,26 +37,6 @@ static void vfio_mdev_close_device(struct vfio_device *core_vdev)
3737
parent->ops->close_device(mdev);
3838
}
3939

40-
static int vfio_mdev_open(struct vfio_device *core_vdev)
41-
{
42-
struct mdev_device *mdev = to_mdev_device(core_vdev->dev);
43-
struct mdev_parent *parent = mdev->type->parent;
44-
45-
if (unlikely(!parent->ops->open))
46-
return 0;
47-
48-
return parent->ops->open(mdev);
49-
}
50-
51-
static void vfio_mdev_release(struct vfio_device *core_vdev)
52-
{
53-
struct mdev_device *mdev = to_mdev_device(core_vdev->dev);
54-
struct mdev_parent *parent = mdev->type->parent;
55-
56-
if (likely(parent->ops->release))
57-
parent->ops->release(mdev);
58-
}
59-
6040
static long vfio_mdev_unlocked_ioctl(struct vfio_device *core_vdev,
6141
unsigned int cmd, unsigned long arg)
6242
{
@@ -122,8 +102,6 @@ static const struct vfio_device_ops vfio_mdev_dev_ops = {
122102
.name = "vfio-mdev",
123103
.open_device = vfio_mdev_open_device,
124104
.close_device = vfio_mdev_close_device,
125-
.open = vfio_mdev_open,
126-
.release = vfio_mdev_release,
127105
.ioctl = vfio_mdev_unlocked_ioctl,
128106
.read = vfio_mdev_read,
129107
.write = vfio_mdev_write,

drivers/vfio/vfio.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,19 +1470,13 @@ static int vfio_group_get_device_fd(struct vfio_group *group, char *buf)
14701470
}
14711471
mutex_unlock(&device->dev_set->lock);
14721472

1473-
if (device->ops->open) {
1474-
ret = device->ops->open(device);
1475-
if (ret)
1476-
goto err_close_device;
1477-
}
1478-
14791473
/*
14801474
* We can't use anon_inode_getfd() because we need to modify
14811475
* the f_mode flags directly to allow more than just ioctls
14821476
*/
14831477
fdno = ret = get_unused_fd_flags(O_CLOEXEC);
14841478
if (ret < 0)
1485-
goto err_release;
1479+
goto err_close_device;
14861480

14871481
filep = anon_inode_getfile("[vfio-device]", &vfio_device_fops,
14881482
device, O_RDWR);
@@ -1509,9 +1503,6 @@ static int vfio_group_get_device_fd(struct vfio_group *group, char *buf)
15091503

15101504
err_fd:
15111505
put_unused_fd(fdno);
1512-
err_release:
1513-
if (device->ops->release)
1514-
device->ops->release(device);
15151506
err_close_device:
15161507
mutex_lock(&device->dev_set->lock);
15171508
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)
16591650
{
16601651
struct vfio_device *device = filep->private_data;
16611652

1662-
if (device->ops->release)
1663-
device->ops->release(device);
1664-
16651653
mutex_lock(&device->dev_set->lock);
16661654
if (!--device->open_count && device->ops->close_device)
16671655
device->ops->close_device(device);

include/linux/mdev.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,6 @@ struct device *mtype_get_parent_dev(struct mdev_type *mtype);
7272
* @mdev: mdev_device device structure which is being
7373
* destroyed
7474
* Returns integer: success (0) or error (< 0)
75-
* @open: Open mediated device.
76-
* @mdev: mediated device.
77-
* Returns integer: success (0) or error (< 0)
78-
* @release: release mediated device
79-
* @mdev: mediated device.
8075
* @read: Read emulation callback
8176
* @mdev: mediated device structure
8277
* @buf: read buffer
@@ -113,8 +108,6 @@ struct mdev_parent_ops {
113108
int (*remove)(struct mdev_device *mdev);
114109
int (*open_device)(struct mdev_device *mdev);
115110
void (*close_device)(struct mdev_device *mdev);
116-
int (*open)(struct mdev_device *mdev);
117-
void (*release)(struct mdev_device *mdev);
118111
ssize_t (*read)(struct mdev_device *mdev, char __user *buf,
119112
size_t count, loff_t *ppos);
120113
ssize_t (*write)(struct mdev_device *mdev, const char __user *buf,

include/linux/vfio.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ struct vfio_device {
4646
*
4747
* @open_device: Called when the first file descriptor is opened for this device
4848
* @close_device: Opposite of open_device
49-
* @open: Called when userspace creates new file descriptor for device
50-
* @release: Called when userspace releases file descriptor for device
5149
* @read: Perform read(2) on device file descriptor
5250
* @write: Perform write(2) on device file descriptor
5351
* @ioctl: Perform ioctl(2) on device file descriptor, supporting VFIO_DEVICE_*
@@ -62,8 +60,6 @@ struct vfio_device_ops {
6260
char *name;
6361
int (*open_device)(struct vfio_device *vdev);
6462
void (*close_device)(struct vfio_device *vdev);
65-
int (*open)(struct vfio_device *vdev);
66-
void (*release)(struct vfio_device *vdev);
6763
ssize_t (*read)(struct vfio_device *vdev, char __user *buf,
6864
size_t count, loff_t *ppos);
6965
ssize_t (*write)(struct vfio_device *vdev, const char __user *buf,

0 commit comments

Comments
 (0)