diff mbox

core/init: create the dt root in main_cpu_entry

Message ID 1474610335-25485-1-git-send-email-oohall@gmail.com
State Accepted
Headers show

Commit Message

Oliver O'Halloran Sept. 23, 2016, 5:58 a.m. UTC
This is created seperately when parsing the hdat and when expanding the
DT. There is no real reason for this and it makes more sense to create
it in the main init path.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
 core/device.c            | 2 --
 core/init.c              | 3 +++
 hdata/spira.c            | 2 --
 hdata/test/hdata_to_dt.c | 2 ++
 4 files changed, 5 insertions(+), 4 deletions(-)

Comments

Stewart Smith Sept. 27, 2016, 7:09 a.m. UTC | #1
Oliver O'Halloran <oohall@gmail.com> writes:
> This is created seperately when parsing the hdat and when expanding the
> DT. There is no real reason for this and it makes more sense to create
> it in the main init path.
>
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
> ---
>  core/device.c            | 2 --
>  core/init.c              | 3 +++
>  hdata/spira.c            | 2 --
>  hdata/test/hdata_to_dt.c | 2 ++
>  4 files changed, 5 insertions(+), 4 deletions(-)

thanks, merged to master as of b915c7088f2ff06d037f89a8251df9f312a43ab2
diff mbox

Patch

diff --git a/core/device.c b/core/device.c
index 9e7ef0d448d9..4fa6a38abb44 100644
--- a/core/device.c
+++ b/core/device.c
@@ -805,8 +805,6 @@  void dt_expand(const void *fdt)
 {
 	printf("FDT: Parsing fdt @%p\n", fdt);
 
-	dt_root = dt_new_root("");
-
 	if (dt_expand_node(dt_root, fdt, 0) < 0)
 		abort();
 }
diff --git a/core/init.c b/core/init.c
index d9e1c240696a..a2daddb86d0b 100644
--- a/core/init.c
+++ b/core/init.c
@@ -707,6 +707,9 @@  void __noreturn __nomcount main_cpu_entry(const void *fdt, u32 master_cpu)
 	 * Hack alert: When entering via the OPAL entry point, fdt
 	 * is set to -1, we record that and pass it to parse_hdat
 	 */
+
+	dt_root = dt_new_root("");
+
 	if (fdt == (void *)-1ul) {
 		if (parse_hdat(true, master_cpu) < 0)
 			abort();
diff --git a/hdata/spira.c b/hdata/spira.c
index e4e6b2d5830c..51d918f87481 100644
--- a/hdata/spira.c
+++ b/hdata/spira.c
@@ -1100,8 +1100,6 @@  int parse_hdat(bool is_opal, uint32_t master_cpu)
 
 	fixup_spira();
 
-	dt_root = dt_new_root("");
-
 	/*
 	 * Basic DT root stuff
 	 */
diff --git a/hdata/test/hdata_to_dt.c b/hdata/test/hdata_to_dt.c
index 86fdf5ca396e..1a644301986d 100644
--- a/hdata/test/hdata_to_dt.c
+++ b/hdata/test/hdata_to_dt.c
@@ -232,6 +232,8 @@  int main(int argc, char *argv[])
 		fclose(stderr);
 	}
 
+	dt_root = dt_new_root("");
+
 	if(parse_hdat(false, 0) < 0) {
 		fprintf(stderr, "FATAL ERROR parsing HDAT\n");
 		exit(EXIT_FAILURE);