Commit 1e04ec14 authored by Jason Gunthorpe's avatar Jason Gunthorpe Committed by Alex Williamson

vfio: Remove device_data from the vfio bus driver API

There are no longer any users, so it can go away. Everything is using
container_of now.
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarKevin Tian <kevin.tian@intel.com>
Reviewed-by: default avatarCornelia Huck <cohuck@redhat.com>
Reviewed-by: default avatarMax Gurtovoy <mgurtovoy@nvidia.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
Message-Id: <14-v3-225de1400dfc+4e074-vfio1_jgg@nvidia.com>
Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
parent 07d47b42
...@@ -254,8 +254,7 @@ vfio_unregister_group_dev() respectively:: ...@@ -254,8 +254,7 @@ vfio_unregister_group_dev() respectively::
void vfio_init_group_dev(struct vfio_device *device, void vfio_init_group_dev(struct vfio_device *device,
struct device *dev, struct device *dev,
const struct vfio_device_ops *ops, const struct vfio_device_ops *ops);
void *device_data);
int vfio_register_group_dev(struct vfio_device *device); int vfio_register_group_dev(struct vfio_device *device);
void vfio_unregister_group_dev(struct vfio_device *device); void vfio_unregister_group_dev(struct vfio_device *device);
......
...@@ -75,7 +75,8 @@ static int vfio_fsl_mc_reflck_attach(struct vfio_fsl_mc_device *vdev) ...@@ -75,7 +75,8 @@ static int vfio_fsl_mc_reflck_attach(struct vfio_fsl_mc_device *vdev)
goto unlock; 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) { if (!cont_vdev || !cont_vdev->reflck) {
vfio_device_put(device); vfio_device_put(device);
ret = -ENODEV; ret = -ENODEV;
...@@ -630,7 +631,7 @@ static int vfio_fsl_mc_probe(struct fsl_mc_device *mc_dev) ...@@ -630,7 +631,7 @@ static int vfio_fsl_mc_probe(struct fsl_mc_device *mc_dev)
goto out_group_put; 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; vdev->mc_dev = mc_dev;
mutex_init(&vdev->igate); mutex_init(&vdev->igate);
......
...@@ -134,7 +134,7 @@ static int vfio_mdev_probe(struct device *dev) ...@@ -134,7 +134,7 @@ static int vfio_mdev_probe(struct device *dev)
if (!vdev) if (!vdev)
return -ENOMEM; return -ENOMEM;
vfio_init_group_dev(vdev, &mdev->dev, &vfio_mdev_dev_ops, mdev); vfio_init_group_dev(vdev, &mdev->dev, &vfio_mdev_dev_ops);
ret = vfio_register_group_dev(vdev); ret = vfio_register_group_dev(vdev);
if (ret) { if (ret) {
kfree(vdev); kfree(vdev);
......
...@@ -2022,7 +2022,7 @@ static int vfio_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -2022,7 +2022,7 @@ static int vfio_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
goto out_group_put; 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->pdev = pdev;
vdev->irq_type = VFIO_PCI_NUM_IRQS; vdev->irq_type = VFIO_PCI_NUM_IRQS;
mutex_init(&vdev->igate); mutex_init(&vdev->igate);
......
...@@ -666,7 +666,7 @@ int vfio_platform_probe_common(struct vfio_platform_device *vdev, ...@@ -666,7 +666,7 @@ int vfio_platform_probe_common(struct vfio_platform_device *vdev,
struct iommu_group *group; struct iommu_group *group;
int ret; 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); ret = vfio_platform_acpi_probe(vdev, dev);
if (ret) if (ret)
......
...@@ -741,12 +741,11 @@ static int vfio_iommu_group_notifier(struct notifier_block *nb, ...@@ -741,12 +741,11 @@ static int vfio_iommu_group_notifier(struct notifier_block *nb,
* VFIO driver API * VFIO driver API
*/ */
void vfio_init_group_dev(struct vfio_device *device, 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)
{ {
init_completion(&device->comp); init_completion(&device->comp);
device->dev = dev; device->dev = dev;
device->ops = ops; device->ops = ops;
device->device_data = device_data;
} }
EXPORT_SYMBOL_GPL(vfio_init_group_dev); EXPORT_SYMBOL_GPL(vfio_init_group_dev);
...@@ -851,15 +850,6 @@ static struct vfio_device *vfio_device_get_from_name(struct vfio_group *group, ...@@ -851,15 +850,6 @@ static struct vfio_device *vfio_device_get_from_name(struct vfio_group *group,
return device; 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 * Decrement the device reference count and wait for the device to be
* removed. Open file descriptors for the device... */ * removed. Open file descriptors for the device... */
......
...@@ -24,7 +24,6 @@ struct vfio_device { ...@@ -24,7 +24,6 @@ struct vfio_device {
refcount_t refcount; refcount_t refcount;
struct completion comp; struct completion comp;
struct list_head group_next; struct list_head group_next;
void *device_data;
}; };
/** /**
...@@ -61,12 +60,11 @@ extern struct iommu_group *vfio_iommu_group_get(struct device *dev); ...@@ -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); 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, 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); int vfio_register_group_dev(struct vfio_device *device);
void vfio_unregister_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 struct vfio_device *vfio_device_get_from_dev(struct device *dev);
extern void vfio_device_put(struct vfio_device *device); 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 */ /* events for the backend driver notify callback */
enum vfio_iommu_notify_type { enum vfio_iommu_notify_type {
......
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