[U-Boot-Users] LIBFDT: first version of fdt_find_compatible_node
Wolfgang Grandegger
wg at grandegger.com
Wed Apr 25 10:58:25 CEST 2007
Hello,
attached you can find a patch implementing fdt_find_compatible_node():
/*
* Find a node based on its device type and one of the tokens in
* its its "compatible" property. On success, the offset of that
* node is returned or an error code:
*
* startoffset - the node to start searching from or 0, the node
* you pass will not be searched, only the next one
* will; typically, you pass 0 to start the search
* and then what the previous call returned.
* type - the device type string to match against
* compat - the string to match to one of the tokens
* in the "compatible" list.
*/
It should be used as shown below:
offset = 0;
do {
offset = fdt_find_compatible_node(fdt, offset, "type", "comp");
} while (offset >= 0);
This first hack also implements a cached version as alternative, because
tag re-scanning might take quite long. In principle, the cache could
also be used for other functions, like fdt_path_offset(), and could be
invalidated in case the FDT gets updated.
What do you think?
Thanks.
Wolfgang.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: u-boot-fdt-find-compatible.patch
Type: text/x-patch
Size: 6384 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20070425/c8d036c1/attachment.bin
More information about the U-Boot
mailing list