From 606ad42aa3b1fe8bb122305bef5aea79a6cef54b Mon Sep 17 00:00:00 2001 From: Rob Herring Date: Wed, 15 Jun 2016 08:32:18 -0500 Subject: of: use pr_fmt prefix for all console printing Clean-up all the DT printk functions to use common pr_fmt prefix. Some print statements such as kmalloc errors were redundant, so just drop those. Cc: Frank Rowand Cc: Pantelis Antoniou Reviewed-by: Frank Rowand Signed-off-by: Rob Herring --- drivers/of/fdt.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/of/fdt.c') diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 33daffc4392c..a0a7b76be381 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -9,6 +9,8 @@ * version 2 as published by the Free Software Foundation. */ +#define pr_fmt(fmt) "OF: fdt:" fmt + #include #include #include @@ -182,14 +184,12 @@ static void populate_properties(const void *blob, val = fdt_getprop_by_offset(blob, cur, &pname, &sz); if (!val) { - pr_warn("%s: Cannot locate property at 0x%x\n", - __func__, cur); + pr_warn("Cannot locate property at 0x%x\n", cur); continue; } if (!pname) { - pr_warn("%s: Cannot find property name at 0x%x\n", - __func__, cur); + pr_warn("Cannot find property name at 0x%x\n", cur); continue; } @@ -439,7 +439,7 @@ static int unflatten_dt_nodes(const void *blob, } if (offset < 0 && offset != -FDT_ERR_NOTFOUND) { - pr_err("%s: Error %d processing FDT\n", __func__, offset); + pr_err("Error %d processing FDT\n", offset); return -EINVAL; } @@ -1281,7 +1281,7 @@ static int __init of_fdt_raw_init(void) if (of_fdt_crc32 != crc32_be(~0, initial_boot_params, fdt_totalsize(initial_boot_params))) { - pr_warn("fdt: not creating '/sys/firmware/fdt': CRC check failed\n"); + pr_warn("not creating '/sys/firmware/fdt': CRC check failed\n"); return 0; } of_fdt_raw_attr.size = fdt_totalsize(initial_boot_params); -- cgit v1.2.3 From 1d1bde550ea3b08a95bd9b6b3adb6d7cd3781870 Mon Sep 17 00:00:00 2001 From: Michal Suchanek Date: Tue, 19 Jul 2016 00:01:12 +0200 Subject: 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 Signed-off-by: Rob Herring --- drivers/of/fdt.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'drivers/of/fdt.c') 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, static void *__unflatten_device_tree(const void *blob, struct device_node *dad, struct device_node **mynodes, - void *(*dt_alloc)(u64 size, u64 align)) + void *(*dt_alloc)(u64 size, u64 align), + bool detached) { int size; void *mem; @@ -516,6 +517,11 @@ static void *__unflatten_device_tree(const void *blob, pr_warning("End of tree marker overwritten: %08x\n", be32_to_cpup(mem + size)); + if (detached) { + of_node_set_flag(*mynodes, OF_DETACHED); + pr_debug("unflattened tree is detached\n"); + } + pr_debug(" <- unflatten_device_tree()\n"); return mem; } @@ -548,7 +554,8 @@ void *of_fdt_unflatten_tree(const unsigned long *blob, void *mem; mutex_lock(&of_fdt_unflatten_mutex); - mem = __unflatten_device_tree(blob, dad, mynodes, &kernel_tree_alloc); + mem = __unflatten_device_tree(blob, dad, mynodes, &kernel_tree_alloc, + true); mutex_unlock(&of_fdt_unflatten_mutex); return mem; @@ -1224,7 +1231,7 @@ bool __init early_init_dt_scan(void *params) void __init unflatten_device_tree(void) { __unflatten_device_tree(initial_boot_params, NULL, &of_root, - early_init_dt_alloc_memory_arch); + early_init_dt_alloc_memory_arch, false); /* Get pointer to "/chosen" and "/aliases" nodes for use everywhere */ of_alias_scan(early_init_dt_alloc_memory_arch); -- cgit v1.2.3