Commit 7ed3ea8a authored by Kirti Wankhede's avatar Kirti Wankhede Committed by Alex Williamson

vfio: Rearrange functions to get vfio_group from dev

This patch rearranges functions to get vfio_group from device
Signed-off-by: default avatarKirti Wankhede <kwankhede@nvidia.com>
Signed-off-by: default avatarNeo Jia <cjia@nvidia.com>
Reviewed-by: default avatarJike Song <jike.song@intel.com>
Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
parent fa3da00c
...@@ -480,6 +480,21 @@ static struct vfio_group *vfio_group_get_from_minor(int minor) ...@@ -480,6 +480,21 @@ static struct vfio_group *vfio_group_get_from_minor(int minor)
return group; return group;
} }
static struct vfio_group *vfio_group_get_from_dev(struct device *dev)
{
struct iommu_group *iommu_group;
struct vfio_group *group;
iommu_group = iommu_group_get(dev);
if (!iommu_group)
return NULL;
group = vfio_group_get_from_iommu(iommu_group);
iommu_group_put(iommu_group);
return group;
}
/** /**
* Device objects - create, release, get, put, search * Device objects - create, release, get, put, search
*/ */
...@@ -811,16 +826,10 @@ EXPORT_SYMBOL_GPL(vfio_add_group_dev); ...@@ -811,16 +826,10 @@ EXPORT_SYMBOL_GPL(vfio_add_group_dev);
*/ */
struct vfio_device *vfio_device_get_from_dev(struct device *dev) struct vfio_device *vfio_device_get_from_dev(struct device *dev)
{ {
struct iommu_group *iommu_group;
struct vfio_group *group; struct vfio_group *group;
struct vfio_device *device; struct vfio_device *device;
iommu_group = iommu_group_get(dev); group = vfio_group_get_from_dev(dev);
if (!iommu_group)
return NULL;
group = vfio_group_get_from_iommu(iommu_group);
iommu_group_put(iommu_group);
if (!group) if (!group)
return NULL; return NULL;
......
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