summaryrefslogtreecommitdiff
path: root/drivers/acpi
diff options
context:
space:
mode:
authorRobin Murphy <robin.murphy@arm.com>2024-04-19 19:54:43 +0300
committerJoerg Roedel <jroedel@suse.de>2024-04-26 13:07:24 +0300
commitfece6530bf4b59b01a476a12851e07751e73d69f (patch)
tree8f70b28470722ccf0ed8636c6e2e280f4abc1e91 /drivers/acpi
parent91cfd679f9e8b9a7bf2f26adf66eff99dbe2026b (diff)
downloadlinux-fece6530bf4b59b01a476a12851e07751e73d69f.tar.xz
dma-mapping: Add helpers for dma_range_map bounds
Several places want to compute the lower and/or upper bounds of a dma_range_map, so let's factor that out into reusable helpers. Acked-by: Rob Herring <robh@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Hanjun Guo <guohanjun@huawei.com> # For arm64 Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Tested-by: Hanjun Guo <guohanjun@huawei.com> Signed-off-by: Robin Murphy <robin.murphy@arm.com> Link: https://lore.kernel.org/r/45ec52f033ec4dfb364e23f48abaf787f612fa53.1713523152.git.robin.murphy@arm.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/arm64/dma.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/drivers/acpi/arm64/dma.c b/drivers/acpi/arm64/dma.c
index b98a149f8d50..52b2abf88689 100644
--- a/drivers/acpi/arm64/dma.c
+++ b/drivers/acpi/arm64/dma.c
@@ -28,13 +28,7 @@ void acpi_arch_dma_setup(struct device *dev)
ret = acpi_dma_get_range(dev, &map);
if (!ret && map) {
- const struct bus_dma_region *r = map;
-
- for (end = 0; r->size; r++) {
- if (r->dma_start + r->size - 1 > end)
- end = r->dma_start + r->size - 1;
- }
-
+ end = dma_range_map_max(map);
dev->dma_range_map = map;
}