is there any actual usage of the device tree node "/chosen at 0"?

Robert P. J. Day rpjday at crashcourse.ca
Mon May 23 13:51:36 EDT 2016


  currently perusing the kernel code for device tree processing and
stumbled across this in drivers/of/base.c:

  void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align))
  {
        struct property *pp;

        of_aliases = of_find_node_by_path("/aliases");
        of_chosen = of_find_node_by_path("/chosen");
        if (of_chosen == NULL)
                of_chosen = of_find_node_by_path("/chosen at 0");  ?????

        if (of_chosen) {
        ... snip ...

that pretty clearly says that "/chosen at 0" is an equivalent node name
for "/chosen", correct? but why was that equivalence first defined?

  if i scan the entire kernel source tree, this is all i get:

$ grep -r "/chosen at 0" *
arch/powerpc/boot/oflib.c:		chosen = of_finddevice("/chosen at 0");
drivers/of/base.c:		of_chosen = of_find_node_by_path("/chosen at 0");
drivers/of/fdt.c:		offset = fdt_path_offset(fdt, "/chosen at 0");
$

so there are apparently three files that *check* for that alternate
name, but not a single .dts or .dtsi that actually uses it. is there
any value to that alternate name?

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================




More information about the Kernelnewbies mailing list