Re: [PATCH] Enabling OF selftest to run without machine's devicetree
From: Gaurav Minocha <hidden>
Date: 2014-07-28 15:16:25
On Mon, Jul 28, 2014 at 8:00 AM, Rob Herring [off-list ref] wrote:
On Sun, Jul 27, 2014 at 10:28 PM, Gaurav Minocha [off-list ref] wrote:quoted
On Sat, Jul 26, 2014 at 3:17 PM, Gaurav Minocha [off-list ref] wrote:quoted
On Sat, Jul 26, 2014 at 2:11 PM, Rob Herring [off-list ref] wrote:quoted
On Sat, Jul 26, 2014 at 2:48 PM, Gaurav Minocha [off-list ref] wrote:quoted
If there is no devicetree present, this patch adds the selftest data as a live devicetree. It also removes the same after the testcase execution is complete.[...]quoted
quoted
quoted
quoted
@@ -614,10 +616,31 @@ static int __init selftest_data_add(void) "not running tests\n", __func__); return -ENOMEM; } - of_fdt_unflatten_tree(selftest_data, &selftest_data_node);Can't you keep this factored out and just do "of_allnodes = selftest_data_node;"?I tried to do that in first place, but of_alias_scan() called from of_fdt_unflatten_tree(..) needs of_allnodes. So, had to call it separately.No, it is not or I'm missing some change. Or it is a bug? It is called from unflatten_device_tree which is the early boot version.
So, there are two functions unflatten_device_tree and of_fdt_unflatten_tree. In of_fdt_unflatten_tree, I added a call to of_alias_scan(). Yes, unflatten_device_tree is the early boot version it already calls of_alias_scan(). I myself was in doubt to call of_alias_scan from of_fdt_unflatten_tree. Though it works fine, may be I'm not aware of a testcase in which it might fail. So, calling explicitly in another option as mentioned earlier.
quoted
Actually, it's possible if rather than calling of_alias_scan from of_fdt_unflatten_tree, I write a wrapper and export it as below. So, I will be able to call of_fdt_alias_scan explicitly. of_fdt_alias_scan() { of_alias_scan(&kernel_tree_alloc); } EXPORT_SYMBOL(of_fdt_alias_scan)I prefer to keep this internal to the DT code. Plus of_fdt_* functions operate on a flat tree and of_alias_scan operates on unflattened tree.quoted
OR directly export of_alias_scan() and kernel_tree_alloc(u64 size, u64 align) please let me know if I should follow either of the above approach in my next patch.Perhaps as you had it is fine. Rob
-- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html