> From: Jason Gunthorpe <jgg@xxxxxxxxxx> > Sent: Saturday, March 13, 2021 8:56 AM > > There are no longer any users, so it can go away. Everything is using > container_of now. > > Reviewed-by: Christoph Hellwig <hch@xxxxxx> > Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx> Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx> > --- > Documentation/driver-api/vfio.rst | 3 +-- > drivers/vfio/fsl-mc/vfio_fsl_mc.c | 5 +++-- > drivers/vfio/mdev/vfio_mdev.c | 2 +- > drivers/vfio/pci/vfio_pci.c | 2 +- > drivers/vfio/platform/vfio_platform_common.c | 2 +- > drivers/vfio/vfio.c | 12 +----------- > include/linux/vfio.h | 4 +--- > 7 files changed, 9 insertions(+), 21 deletions(-) > > diff --git a/Documentation/driver-api/vfio.rst b/Documentation/driver- > api/vfio.rst > index 3337f337293a32..decc68cb8114ac 100644 > --- a/Documentation/driver-api/vfio.rst > +++ b/Documentation/driver-api/vfio.rst > @@ -254,8 +254,7 @@ vfio_unregister_group_dev() respectively:: > > void vfio_init_group_dev(struct vfio_device *device, > struct device *dev, > - const struct vfio_device_ops *ops, > - void *device_data); > + const struct vfio_device_ops *ops); > int vfio_register_group_dev(struct vfio_device *device); > void vfio_unregister_group_dev(struct vfio_device *device); > > diff --git a/drivers/vfio/fsl-mc/vfio_fsl_mc.c b/drivers/vfio/fsl- > mc/vfio_fsl_mc.c > index 023b2222806424..3af3ca59478f94 100644 > --- a/drivers/vfio/fsl-mc/vfio_fsl_mc.c > +++ b/drivers/vfio/fsl-mc/vfio_fsl_mc.c > @@ -75,7 +75,8 @@ static int vfio_fsl_mc_reflck_attach(struct > vfio_fsl_mc_device *vdev) > goto unlock; > } > > - cont_vdev = vfio_device_data(device); > + cont_vdev = > + container_of(device, struct vfio_fsl_mc_device, vdev); > if (!cont_vdev || !cont_vdev->reflck) { > vfio_device_put(device); > ret = -ENODEV; > @@ -624,7 +625,7 @@ static int vfio_fsl_mc_probe(struct fsl_mc_device > *mc_dev) > goto out_group_put; > } > > - vfio_init_group_dev(&vdev->vdev, dev, &vfio_fsl_mc_ops, vdev); > + vfio_init_group_dev(&vdev->vdev, dev, &vfio_fsl_mc_ops); > vdev->mc_dev = mc_dev; > mutex_init(&vdev->igate); > > diff --git a/drivers/vfio/mdev/vfio_mdev.c b/drivers/vfio/mdev/vfio_mdev.c > index e7309caa99c71b..71bd28f976e5af 100644 > --- a/drivers/vfio/mdev/vfio_mdev.c > +++ b/drivers/vfio/mdev/vfio_mdev.c > @@ -138,7 +138,7 @@ static int vfio_mdev_probe(struct device *dev) > if (!mvdev) > return -ENOMEM; > > - vfio_init_group_dev(&mvdev->vdev, &mdev->dev, > &vfio_mdev_dev_ops, mdev); > + vfio_init_group_dev(&mvdev->vdev, &mdev->dev, > &vfio_mdev_dev_ops); > ret = vfio_register_group_dev(&mvdev->vdev); > if (ret) { > kfree(mvdev); > diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c > index 1f70387c8afe37..55ef27a15d4d3f 100644 > --- a/drivers/vfio/pci/vfio_pci.c > +++ b/drivers/vfio/pci/vfio_pci.c > @@ -2022,7 +2022,7 @@ static int vfio_pci_probe(struct pci_dev *pdev, > const struct pci_device_id *id) > goto out_group_put; > } > > - vfio_init_group_dev(&vdev->vdev, &pdev->dev, &vfio_pci_ops, vdev); > + vfio_init_group_dev(&vdev->vdev, &pdev->dev, &vfio_pci_ops); > vdev->pdev = pdev; > vdev->irq_type = VFIO_PCI_NUM_IRQS; > mutex_init(&vdev->igate); > diff --git a/drivers/vfio/platform/vfio_platform_common.c > b/drivers/vfio/platform/vfio_platform_common.c > index f5f6b537084a67..361e5b57e36932 100644 > --- a/drivers/vfio/platform/vfio_platform_common.c > +++ b/drivers/vfio/platform/vfio_platform_common.c > @@ -666,7 +666,7 @@ int vfio_platform_probe_common(struct > vfio_platform_device *vdev, > struct iommu_group *group; > int ret; > > - vfio_init_group_dev(&vdev->vdev, dev, &vfio_platform_ops, vdev); > + vfio_init_group_dev(&vdev->vdev, dev, &vfio_platform_ops); > > ret = vfio_platform_acpi_probe(vdev, dev); > if (ret) > diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c > index 01de47d1810b6b..39ea77557ba0c4 100644 > --- a/drivers/vfio/vfio.c > +++ b/drivers/vfio/vfio.c > @@ -741,12 +741,11 @@ static int vfio_iommu_group_notifier(struct > notifier_block *nb, > * VFIO driver API > */ > void vfio_init_group_dev(struct vfio_device *device, struct device *dev, > - const struct vfio_device_ops *ops, void *device_data) > + const struct vfio_device_ops *ops) > { > init_completion(&device->comp); > device->dev = dev; > device->ops = ops; > - device->device_data = device_data; > } > EXPORT_SYMBOL_GPL(vfio_init_group_dev); > > @@ -851,15 +850,6 @@ static struct vfio_device > *vfio_device_get_from_name(struct vfio_group *group, > return device; > } > > -/* > - * Caller must hold a reference to the vfio_device > - */ > -void *vfio_device_data(struct vfio_device *device) > -{ > - return device->device_data; > -} > -EXPORT_SYMBOL_GPL(vfio_device_data); > - > /* > * Decrement the device reference count and wait for the device to be > * removed. Open file descriptors for the device... */ > diff --git a/include/linux/vfio.h b/include/linux/vfio.h > index 784c34c0a28763..a2c5b30e1763ba 100644 > --- a/include/linux/vfio.h > +++ b/include/linux/vfio.h > @@ -24,7 +24,6 @@ struct vfio_device { > refcount_t refcount; > struct completion comp; > struct list_head group_next; > - void *device_data; > }; > > /** > @@ -61,12 +60,11 @@ extern struct iommu_group > *vfio_iommu_group_get(struct device *dev); > extern void vfio_iommu_group_put(struct iommu_group *group, struct > device *dev); > > void vfio_init_group_dev(struct vfio_device *device, struct device *dev, > - const struct vfio_device_ops *ops, void > *device_data); > + const struct vfio_device_ops *ops); > int vfio_register_group_dev(struct vfio_device *device); > void vfio_unregister_group_dev(struct vfio_device *device); > extern struct vfio_device *vfio_device_get_from_dev(struct device *dev); > extern void vfio_device_put(struct vfio_device *device); > -extern void *vfio_device_data(struct vfio_device *device); > > /* events for the backend driver notify callback */ > enum vfio_iommu_notify_type { > -- > 2.30.2