devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: skseofh@gmail.com
To: robh@kernel.org, saravanak@google.com
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Daero Lee <skseofh@gmail.com>
Subject: [PATCH] of: of_reserved_mem: remove repeated call to get no-map property
Date: Fri, 12 Apr 2024 23:09:38 +0900	[thread overview]
Message-ID: <20240412140938.137803-1-skseofh@gmail.com> (raw)

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


             reply	other threads:[~2024-04-12 14:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-12 14:09 skseofh [this message]
2024-04-16 13:15 ` [PATCH] of: of_reserved_mem: remove repeated call to get no-map property Rob Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240412140938.137803-1-skseofh@gmail.com \
    --to=skseofh@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=saravanak@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).