devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] of: of_reserved_mem: remove repeated call to get no-map property
@ 2024-04-12 14:09 skseofh
  2024-04-16 13:15 ` Rob Herring
  0 siblings, 1 reply; 2+ messages in thread
From: skseofh @ 2024-04-12 14:09 UTC (permalink / raw)
  To: robh, saravanak; +Cc: devicetree, linux-kernel, Daero Lee

From: Daero Lee <skseofh@gmail.com>

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@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] of: of_reserved_mem: remove repeated call to get no-map property
  2024-04-12 14:09 [PATCH] of: of_reserved_mem: remove repeated call to get no-map property skseofh
@ 2024-04-16 13:15 ` Rob Herring
  0 siblings, 0 replies; 2+ messages in thread
From: Rob Herring @ 2024-04-16 13:15 UTC (permalink / raw)
  To: skseofh; +Cc: saravanak, devicetree, linux-kernel

On Fri, Apr 12, 2024 at 11:09:38PM +0900, skseofh@gmail.com wrote:
> From: Daero Lee <skseofh@gmail.com>
> 
> 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.

This code is all about to get rearranged[1], so holding off on this.

Rob

[1] https://lore.kernel.org/lkml/20240328211543.191876-1-quic_obabatun@quicinc.com/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-04-16 13:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-12 14:09 [PATCH] of: of_reserved_mem: remove repeated call to get no-map property skseofh
2024-04-16 13:15 ` Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).