diff options
author | Robin Murphy <robin.murphy@arm.com> | 2024-04-19 17:54:43 +0100 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2024-04-26 12:07:24 +0200 |
commit | fece6530bf4b59b01a476a12851e07751e73d69f (patch) | |
tree | 8f70b28470722ccf0ed8636c6e2e280f4abc1e91 /drivers/of | |
parent | 91cfd679f9e8b9a7bf2f26adf66eff99dbe2026b (diff) | |
download | lwn-fece6530bf4b59b01a476a12851e07751e73d69f.tar.gz lwn-fece6530bf4b59b01a476a12851e07751e73d69f.zip |
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/of')
-rw-r--r-- | drivers/of/device.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/drivers/of/device.c b/drivers/of/device.c index 841ccd3a19d1..9e7963972fa7 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c @@ -117,16 +117,9 @@ int of_dma_configure_id(struct device *dev, struct device_node *np, if (!force_dma) return ret == -ENODEV ? 0 : ret; } else { - const struct bus_dma_region *r = map; - /* Determine the overall bounds of all DMA regions */ - for (dma_start = ~0; r->size; r++) { - /* Take lower and upper limits */ - if (r->dma_start < dma_start) - dma_start = r->dma_start; - if (r->dma_start + r->size > end) - end = r->dma_start + r->size; - } + dma_start = dma_range_map_min(map); + end = dma_range_map_max(map); } /* |