From: Rob Herring <robh@kernel.org>
To: James Hogan <jhogan@kernel.org>
Cc: John Crispin <john@phrozen.org>,
Ralf Baechle <ralf@linux-mips.org>,
linux-mips@linux-mips.org
Subject: [PATCH] MIPS: ralink: use memblock instead of rescanning the FDT
Date: Tue, 27 Mar 2018 20:14:35 -0500 [thread overview]
Message-ID: <20180328011435.29776-1-robh@kernel.org> (raw)
There's no need to scan /memory nodes twice. The DT core code scans
nodes and adds memblocks already, so we can just use
memblock_phys_mem_size() to see if we have any memory already setup.
Signed-off-by: Rob Herring <robh@kernel.org>
Cc: John Crispin <john@phrozen.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: James Hogan <jhogan@kernel.org>
Cc: linux-mips@linux-mips.org
---
arch/mips/ralink/of.c | 21 +++++----------------
1 file changed, 5 insertions(+), 16 deletions(-)
diff --git a/arch/mips/ralink/of.c b/arch/mips/ralink/of.c
index 1ada8492733b..cf3b01b5c624 100644
--- a/arch/mips/ralink/of.c
+++ b/arch/mips/ralink/of.c
@@ -14,7 +14,7 @@
#include <linux/sizes.h>
#include <linux/of_fdt.h>
#include <linux/kernel.h>
-#include <linux/bootmem.h>
+#include <linux/memblock.h>
#include <linux/of_platform.h>
#include <linux/of_address.h>
@@ -53,17 +53,6 @@ void __init device_tree_init(void)
unflatten_and_copy_device_tree();
}
-static int memory_dtb;
-
-static int __init early_init_dt_find_memory(unsigned long node,
- const char *uname, int depth, void *data)
-{
- if (depth == 1 && !strcmp(uname, "memory@0"))
- memory_dtb = 1;
-
- return 0;
-}
-
void __init plat_mem_setup(void)
{
void *dtb = NULL;
@@ -82,10 +71,10 @@ void __init plat_mem_setup(void)
__dt_setup_arch(dtb);
- of_scan_flat_dt(early_init_dt_find_memory, NULL);
- if (memory_dtb)
- of_scan_flat_dt(early_init_dt_scan_memory, NULL);
- else if (soc_info.mem_size)
+ if (memblock_phys_mem_size())
+ return;
+
+ if (soc_info.mem_size)
add_memory_region(soc_info.mem_base, soc_info.mem_size * SZ_1M,
BOOT_MEM_RAM);
else
--
2.14.1
next reply other threads:[~2018-03-28 1:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-28 1:14 Rob Herring [this message]
2018-05-02 2:38 ` [PATCH] MIPS: ralink: use memblock instead of rescanning the FDT Rob Herring
[not found] ` <20180508233758.GE14903@jamesdev>
2018-05-10 12:55 ` 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=20180328011435.29776-1-robh@kernel.org \
--to=robh@kernel.org \
--cc=jhogan@kernel.org \
--cc=john@phrozen.org \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.org \
/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