summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Suchanek <hramrach@gmail.com>2016-07-18 18:01:12 -0400
committerRob Herring <robh@kernel.org>2016-07-18 18:27:04 -0400
commit1d1bde550ea3b08a95bd9b6b3adb6d7cd3781870 (patch)
tree819c9f8d12c770d8da96463aa9096289979002fe
parent5de3bbc8501b637eb753e4ee18a2cccb233cfe41 (diff)
of: fdt: mark unflattened tree as detached
The tree returned from of_fdt_unflatten_tree cannot be attached to the live tree because it is not marked as detached so mark it as such. The dt resolver checks the flag and refuses to process the tree otherwise. Signed-off-by: Michal Suchanek <hramrach@gmail.com> Signed-off-by: Rob Herring <robh@kernel.org>
-rw-r--r--drivers/of/fdt.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index a0a7b76be381..ae4d07bcce24 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -472,7 +472,8 @@ static int unflatten_dt_nodes(const void *blob,
472static void *__unflatten_device_tree(const void *blob, 472static void *__unflatten_device_tree(const void *blob,
473 struct device_node *dad, 473 struct device_node *dad,
474 struct device_node **mynodes, 474 struct device_node **mynodes,
475 void *(*dt_alloc)(u64 size, u64 align)) 475 void *(*dt_alloc)(u64 size, u64 align),
476 bool detached)
476{ 477{
477 int size; 478 int size;
478 void *mem; 479 void *mem;
@@ -516,6 +517,11 @@ static void *__unflatten_device_tree(const void *blob,
516 pr_warning("End of tree marker overwritten: %08x\n", 517 pr_warning("End of tree marker overwritten: %08x\n",
517 be32_to_cpup(mem + size)); 518 be32_to_cpup(mem + size));
518 519
520 if (detached) {
521 of_node_set_flag(*mynodes, OF_DETACHED);
522 pr_debug("unflattened tree is detached\n");
523 }
524
519 pr_debug(" <- unflatten_device_tree()\n"); 525 pr_debug(" <- unflatten_device_tree()\n");
520 return mem; 526 return mem;
521} 527}
@@ -548,7 +554,8 @@ void *of_fdt_unflatten_tree(const unsigned long *blob,
548 void *mem; 554 void *mem;
549 555
550 mutex_lock(&of_fdt_unflatten_mutex); 556 mutex_lock(&of_fdt_unflatten_mutex);
551 mem = __unflatten_device_tree(blob, dad, mynodes, &kernel_tree_alloc); 557 mem = __unflatten_device_tree(blob, dad, mynodes, &kernel_tree_alloc,
558 true);
552 mutex_unlock(&of_fdt_unflatten_mutex); 559 mutex_unlock(&of_fdt_unflatten_mutex);
553 560
554 return mem; 561 return mem;
@@ -1224,7 +1231,7 @@ bool __init early_init_dt_scan(void *params)
1224void __init unflatten_device_tree(void) 1231void __init unflatten_device_tree(void)
1225{ 1232{
1226 __unflatten_device_tree(initial_boot_params, NULL, &of_root, 1233 __unflatten_device_tree(initial_boot_params, NULL, &of_root,
1227 early_init_dt_alloc_memory_arch); 1234 early_init_dt_alloc_memory_arch, false);
1228 1235
1229 /* Get pointer to "/chosen" and "/aliases" nodes for use everywhere */ 1236 /* Get pointer to "/chosen" and "/aliases" nodes for use everywhere */
1230 of_alias_scan(early_init_dt_alloc_memory_arch); 1237 of_alias_scan(early_init_dt_alloc_memory_arch);