dma-heap: qcom: Simplify memory-region property lookup

The base and size are available in struct reserved_mem. Use that
instead of of_get_address. This fixes an issue where the base and
size of heaps without a reg property was not being detected.

Change-Id: I48977a1c026e7a2001746eda0aa82a47992a2f6f
Signed-off-by: Patrick Daly <quic_pdaly@quicinc.com>
Signed-off-by: Srinivasarao Pathipati <quic_c_spathi@quicinc.com>
This commit is contained in:
Patrick Daly 2023-11-29 17:38:01 -08:00 committed by Srinivasarao Pathipati
parent 598e0566b8
commit 6d6a9fe561

View file

@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/of.h>
@ -66,8 +66,6 @@ void free_pdata(const struct platform_data *pdata)
static int heap_dt_init(struct device_node *mem_node,
struct platform_heap *heap)
{
const __be32 *basep;
u64 base, size;
struct device *dev = heap->dev;
struct reserved_mem *rmem;
int ret = 0;
@ -97,19 +95,8 @@ static int heap_dt_init(struct device_node *mem_node,
}
}
basep = of_get_address(mem_node, 0, &size, NULL);
if (basep) {
base = of_translate_address(mem_node, basep);
if (base != OF_BAD_ADDR) {
heap->base = base;
heap->size = size;
} else {
ret = -EINVAL;
dev_err(heap->dev,
"Failed to get heap base/size\n");
of_reserved_mem_device_release(dev);
}
}
heap->base = rmem->base;
heap->size = rmem->size;
heap->is_nomap = of_property_read_bool(mem_node, "no-map");
return ret;