vfio/pci: Replace uses of vfio_device_data() with container_of
authorJason Gunthorpe <jgg@nvidia.com>
Tue, 30 Mar 2021 15:53:08 +0000 (09:53 -0600)
committerAlex Williamson <alex.williamson@redhat.com>
Tue, 6 Apr 2021 17:55:11 +0000 (11:55 -0600)
commit07d47b4222d5d1cd933f01587dda00398d8daf40
tree061279e8301a8e031932304a6a8ab8f061c2cdd9
parent6df62c5b05f4ad6876815ea8b8775905a090224a
vfio/pci: Replace uses of vfio_device_data() with container_of

This tidies a few confused places that think they can have a refcount on
the vfio_device but the device_data could be NULL, that isn't possible by
design.

Most of the change falls out when struct vfio_devices is updated to just
store the struct vfio_pci_device itself. This wasn't possible before
because there was no easy way to get from the 'struct vfio_pci_device' to
the 'struct vfio_device' to put back the refcount.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Message-Id: <13-v3-225de1400dfc+4e074-vfio1_jgg@nvidia.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/pci/vfio_pci.c