Browse Source

improve documentation for fdt_path_offset()

The current documentation doesn't mention the possibility of passing a
non-absolute path and having that treated as an alias. Add that
information, along with an example (which will further be expanded in
a subsequent patch), and clarify when -FDT_ERR_BADPATH can be returned.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
main
Rasmus Villemoes 2 years ago committed by David Gibson
parent
commit
60bcf1cde1
  1. 27
      libfdt/libfdt.h

27
libfdt/libfdt.h

@ -524,10 +524,35 @@ int fdt_path_offset_namelen(const void *fdt, const char *path, int namelen); @@ -524,10 +524,35 @@ int fdt_path_offset_namelen(const void *fdt, const char *path, int namelen);
* level matching the given component, differentiated only by unit
* address).
*
* If the path is not absolute (i.e. does not begin with '/'), the
* first component is treated as an alias. That is, the property by
* that name is looked up in the /aliases node, and the value of that
* property used in place of that first component.
*
* For example, for this small fragment
*
* / {
* aliases {
* i2c2 = &foo; // RHS compiles to "/soc@0/i2c@30a40000/eeprom@52"
* };
* soc@0 {
* foo: i2c@30a40000 {
* bar: eeprom@52 {
* };
* };
* };
* };
*
* these would be equivalent:
*
* /soc@0/i2c@30a40000/eeprom@52
* i2c2/eeprom@52
*
* returns:
* structure block offset of the node with the requested path (>=0), on
* success
* -FDT_ERR_BADPATH, given path does not begin with '/' or is invalid
* -FDT_ERR_BADPATH, given path does not begin with '/' and the first
* component is not a valid alias
* -FDT_ERR_NOTFOUND, if the requested node does not exist
* -FDT_ERR_BADMAGIC,
* -FDT_ERR_BADVERSION,

Loading…
Cancel
Save