diff options
author | Jason Gunthorpe <jgg@nvidia.com> | 2021-03-30 18:53:06 +0300 |
---|---|---|
committer | Alex Williamson <alex.williamson@redhat.com> | 2021-04-06 20:55:10 +0300 |
commit | cb6164586814bbe41f55559ae5505d8373d6f781 (patch) | |
tree | 9f1e036b825daf5f1c98c6f4e0aa4a2d51bf01d7 /drivers/vfio/platform/vfio_platform.c | |
parent | 0bfc6a4ea63c2adac71a824397ef48f28dbc5e47 (diff) | |
download | linux-cb6164586814bbe41f55559ae5505d8373d6f781.tar.xz |
vfio/platform: Use vfio_init/register/unregister_group_dev
platform already allocates a struct vfio_platform_device with exactly
the same lifetime as vfio_device, switch to the new API and embed
vfio_device in vfio_platform_device.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Message-Id: <4-v3-225de1400dfc+4e074-vfio1_jgg@nvidia.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'drivers/vfio/platform/vfio_platform.c')
-rw-r--r-- | drivers/vfio/platform/vfio_platform.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/vfio/platform/vfio_platform.c b/drivers/vfio/platform/vfio_platform.c index 9fb6818cea12..e4027799a154 100644 --- a/drivers/vfio/platform/vfio_platform.c +++ b/drivers/vfio/platform/vfio_platform.c @@ -54,23 +54,21 @@ static int vfio_platform_probe(struct platform_device *pdev) vdev->reset_required = reset_required; ret = vfio_platform_probe_common(vdev, &pdev->dev); - if (ret) + if (ret) { kfree(vdev); - - return ret; + return ret; + } + dev_set_drvdata(&pdev->dev, vdev); + return 0; } static int vfio_platform_remove(struct platform_device *pdev) { - struct vfio_platform_device *vdev; - - vdev = vfio_platform_remove_common(&pdev->dev); - if (vdev) { - kfree(vdev); - return 0; - } + struct vfio_platform_device *vdev = dev_get_drvdata(&pdev->dev); - return -EINVAL; + vfio_platform_remove_common(vdev); + kfree(vdev); + return 0; } static struct platform_driver vfio_platform_driver = { |