On Mon, Jul 28, 2014 at 8:00 AM, Rob Herring <robherring2@xxxxxxxxx> wrote: > On Sun, Jul 27, 2014 at 10:28 PM, Gaurav Minocha > <gaurav.minocha.os@xxxxxxxxx> wrote: >> On Sat, Jul 26, 2014 at 3:17 PM, Gaurav Minocha >> <gaurav.minocha.os@xxxxxxxxx> wrote: >>> On Sat, Jul 26, 2014 at 2:11 PM, Rob Herring <robherring2@xxxxxxxxx> wrote: >>>> On Sat, Jul 26, 2014 at 2:48 PM, Gaurav Minocha >>>> <gaurav.minocha.os@xxxxxxxxx> wrote: >>>>> 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. > > [...] > >>>>> @@ -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. >> 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. > >> >> 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@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html