iommu: virtio: Use generic_iommu_put_resv_regions()

Use the new standard function instead of open-coding it.

Cc: Jean-Philippe Brucker <jean-philippe@linaro.org>
Cc: virtualization@lists.linux-foundation.org
Reviewed-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
This commit is contained in:
Thierry Reding 2019-12-18 14:42:05 +01:00 committed by Joerg Roedel
parent 0ecdebb7da
commit c11738cf9d
1 changed files with 3 additions and 11 deletions

View File

@ -837,14 +837,6 @@ static void viommu_get_resv_regions(struct device *dev, struct list_head *head)
iommu_dma_get_resv_regions(dev, head); iommu_dma_get_resv_regions(dev, head);
} }
static void viommu_put_resv_regions(struct device *dev, struct list_head *head)
{
struct iommu_resv_region *entry, *next;
list_for_each_entry_safe(entry, next, head, list)
kfree(entry);
}
static struct iommu_ops viommu_ops; static struct iommu_ops viommu_ops;
static struct virtio_driver virtio_iommu_drv; static struct virtio_driver virtio_iommu_drv;
@ -914,7 +906,7 @@ static int viommu_add_device(struct device *dev)
err_unlink_dev: err_unlink_dev:
iommu_device_unlink(&viommu->iommu, dev); iommu_device_unlink(&viommu->iommu, dev);
err_free_dev: err_free_dev:
viommu_put_resv_regions(dev, &vdev->resv_regions); generic_iommu_put_resv_regions(dev, &vdev->resv_regions);
kfree(vdev); kfree(vdev);
return ret; return ret;
@ -932,7 +924,7 @@ static void viommu_remove_device(struct device *dev)
iommu_group_remove_device(dev); iommu_group_remove_device(dev);
iommu_device_unlink(&vdev->viommu->iommu, dev); iommu_device_unlink(&vdev->viommu->iommu, dev);
viommu_put_resv_regions(dev, &vdev->resv_regions); generic_iommu_put_resv_regions(dev, &vdev->resv_regions);
kfree(vdev); kfree(vdev);
} }
@ -961,7 +953,7 @@ static struct iommu_ops viommu_ops = {
.remove_device = viommu_remove_device, .remove_device = viommu_remove_device,
.device_group = viommu_device_group, .device_group = viommu_device_group,
.get_resv_regions = viommu_get_resv_regions, .get_resv_regions = viommu_get_resv_regions,
.put_resv_regions = viommu_put_resv_regions, .put_resv_regions = generic_iommu_put_resv_regions,
.of_xlate = viommu_of_xlate, .of_xlate = viommu_of_xlate,
}; };