[PATCH] of: of_reserved_mem: remove repeated call to get no-map property
From: skseofh
Date: Fri Apr 12 2024 - 10:10:17 EST
From: Daero Lee <skseofh@xxxxxxxxx>
In __reserved_mem_alloc_size, of_get_flat_dt_prop is called and checked
whether the "no-map" property exists for the node. In
fdt_init_reserved_mem, the only caller of __reserved_mem_alloc_size,
we checked this again for the same node. Therefore, repeated
of_get_flat_dt_prop call was removed and 'nomap' was passed as an input
parameter to the callee function.
Signed-off-by: Daero Lee <skseofh@xxxxxxxxx>
---
drivers/of/of_reserved_mem.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
index 8236ecae2953..cb86a28379c7 100644
--- a/drivers/of/of_reserved_mem.c
+++ b/drivers/of/of_reserved_mem.c
@@ -254,14 +254,13 @@ static int __init __reserved_mem_alloc_in_range(phys_addr_t size,
* 'size', 'alignment' and 'alloc-ranges' properties.
*/
static int __init __reserved_mem_alloc_size(unsigned long node,
- const char *uname, phys_addr_t *res_base, phys_addr_t *res_size)
+ const char *uname, phys_addr_t *res_base, phys_addr_t *res_size, bool nomap)
{
int t_len = (dt_root_addr_cells + dt_root_size_cells) * sizeof(__be32);
phys_addr_t start = 0, end = 0;
phys_addr_t base = 0, align = 0, size;
int len;
const __be32 *prop;
- bool nomap;
int ret;
prop = of_get_flat_dt_prop(node, "size", &len);
@@ -284,8 +283,6 @@ static int __init __reserved_mem_alloc_size(unsigned long node,
align = dt_mem_next_cell(dt_root_addr_cells, &prop);
}
- nomap = of_get_flat_dt_prop(node, "no-map", NULL) != NULL;
-
/* Need adjust the alignment to satisfy the CMA requirement */
if (IS_ENABLED(CONFIG_CMA)
&& of_flat_dt_is_compatible(node, "shared-dma-pool")
@@ -451,7 +448,7 @@ void __init fdt_init_reserved_mem(void)
if (rmem->size == 0)
err = __reserved_mem_alloc_size(node, rmem->name,
- &rmem->base, &rmem->size);
+ &rmem->base, &rmem->size, nomap);
if (err == 0) {
err = __reserved_mem_init_node(rmem);
if (err != 0 && err != -ENOENT) {
--
2.25.1