[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5819C2C7.3060700@intel.com>
Date: Wed, 02 Nov 2016 18:41:11 +0800
From: Jike Song <jike.song@...el.com>
To: Kirti Wankhede <kwankhede@...dia.com>
CC: alex.williamson@...hat.com, pbonzini@...hat.com, kraxel@...hat.com,
cjia@...dia.com, qemu-devel@...gnu.org, kvm@...r.kernel.org,
kevin.tian@...el.com, bjsdjshi@...ux.vnet.ibm.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v10 03/19] vfio: Rearrange functions to get vfio_group
from dev
On 10/27/2016 05:29 AM, Kirti Wankhede wrote:
> This patch rearranges functions to get vfio_group from device
>
> Signed-off-by: Kirti Wankhede <kwankhede@...dia.com>
> Signed-off-by: Neo Jia <cjia@...dia.com>
> Change-Id: I1f93262bdbab75094bc24b087b29da35ba70c4c6
> ---
> drivers/vfio/vfio.c | 23 ++++++++++++++++-------
> 1 file changed, 16 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
> index d1d70e0b011b..23bc86c1d05d 100644
> --- a/drivers/vfio/vfio.c
> +++ b/drivers/vfio/vfio.c
> @@ -480,6 +480,21 @@ static struct vfio_group *vfio_group_get_from_minor(int minor)
> 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
> */
> @@ -811,16 +826,10 @@ EXPORT_SYMBOL_GPL(vfio_add_group_dev);
> */
> struct vfio_device *vfio_device_get_from_dev(struct device *dev)
> {
> - struct iommu_group *iommu_group;
> struct vfio_group *group;
> struct vfio_device *device;
>
> - iommu_group = iommu_group_get(dev);
> - if (!iommu_group)
> - return NULL;
> -
> - group = vfio_group_get_from_iommu(iommu_group);
> - iommu_group_put(iommu_group);
> + group = vfio_group_get_from_dev(dev);
> if (!group)
> return NULL;
>
Reviewed-by: Jike Song <jike.song@...el.com>
--
Thanks,
Jike
Powered by blists - more mailing lists