Skip to content

Commit c11738c

Browse files
thierryredingjoergroedel
authored andcommitted
iommu: virtio: Use generic_iommu_put_resv_regions()
Use the new standard function instead of open-coding it. Cc: Jean-Philippe Brucker <[email protected]> Cc: [email protected] Reviewed-by: Jean-Philippe Brucker <[email protected]> Signed-off-by: Thierry Reding <[email protected]> Signed-off-by: Joerg Roedel <[email protected]>
1 parent 0ecdebb commit c11738c

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

drivers/iommu/virtio-iommu.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -837,14 +837,6 @@ static void viommu_get_resv_regions(struct device *dev, struct list_head *head)
837837
iommu_dma_get_resv_regions(dev, head);
838838
}
839839

840-
static void viommu_put_resv_regions(struct device *dev, struct list_head *head)
841-
{
842-
struct iommu_resv_region *entry, *next;
843-
844-
list_for_each_entry_safe(entry, next, head, list)
845-
kfree(entry);
846-
}
847-
848840
static struct iommu_ops viommu_ops;
849841
static struct virtio_driver virtio_iommu_drv;
850842

@@ -914,7 +906,7 @@ static int viommu_add_device(struct device *dev)
914906
err_unlink_dev:
915907
iommu_device_unlink(&viommu->iommu, dev);
916908
err_free_dev:
917-
viommu_put_resv_regions(dev, &vdev->resv_regions);
909+
generic_iommu_put_resv_regions(dev, &vdev->resv_regions);
918910
kfree(vdev);
919911

920912
return ret;
@@ -932,7 +924,7 @@ static void viommu_remove_device(struct device *dev)
932924

933925
iommu_group_remove_device(dev);
934926
iommu_device_unlink(&vdev->viommu->iommu, dev);
935-
viommu_put_resv_regions(dev, &vdev->resv_regions);
927+
generic_iommu_put_resv_regions(dev, &vdev->resv_regions);
936928
kfree(vdev);
937929
}
938930

@@ -961,7 +953,7 @@ static struct iommu_ops viommu_ops = {
961953
.remove_device = viommu_remove_device,
962954
.device_group = viommu_device_group,
963955
.get_resv_regions = viommu_get_resv_regions,
964-
.put_resv_regions = viommu_put_resv_regions,
956+
.put_resv_regions = generic_iommu_put_resv_regions,
965957
.of_xlate = viommu_of_xlate,
966958
};
967959

0 commit comments

Comments
 (0)