[U-Boot-Users] fdt_find_compatible_node() and friends

Wolfgang Grandegger wg at grandegger.com
Sat May 5 15:03:55 CEST 2007


Hi Jerry,

Jerry Van Baren wrote:
> Wolfgang Grandegger wrote:
>> Hi Jerry,
>>
>> before re-coding fdt_find_compatible_node(), some more comments.
>>
>> After browsing more carefully the FDT related code of "arch/powerpc"
>> I think we also need, apart from fdt_find_compatible_node() and
>> fdt_path_offset(), fdt_find_node_by_type() and maybe 
>> fdt_find_node_by_name(). These functions do a sequential scan of all 
>> devices starting at the beginning or after a specified node. They 
>> actually ignore the hierarchy. Do you agree?
>> BTW: any reason why not using the more compatible name 
>> fdt_find_node_by_path() for fdt_path_offset()?
>>
>> Wolfgang.
> 
> Hi WolfganG,
> 
> I'm not an expert, I just fake it on email ;-).  With that disclaimer, I 
> would agree with you WRT all the "find" functions.  The original libfdt 
> code does not support any "find" functions, so we will need to add them.
> 
> WRT to fdt_find_node_by_path() vs. fdt_path_offset(), I vaguely recall 
> some renames happening in the kernel source, but I cannot find them so 
> my memory likely is faulty[1].  I would be strongly in favor of 
> following the kernel's lead and renaming that function since we are 
> already divergent from the original libfdt.  The kernel's name is a much 
> better description.

OK, I have attached two new patches replacing fdt_path_offset() with 
fdt_find_node_by_path() and implementing fdt_find_node_by_type() and 
fdt_find_compatible_node(). This version does not use static variables 
any more to scan the nodes without re-scanning, but looks for the end 
tag. I think it's (almost) good enough to be applied.

Wolfgang.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: fdt-find-node-by-path.patch
Type: text/x-patch
Size: 6187 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20070505/2e942f0b/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fdt-find-compatible-node.patch
Type: text/x-patch
Size: 6175 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20070505/2e942f0b/attachment-0001.bin 


More information about the U-Boot mailing list