diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2008-08-20 16:55:14 +1000 |
---|---|---|
committer | Gerald Van Baren <vanbaren@cideas.com> | 2008-10-02 19:06:09 -0400 |
commit | 9a6cf73a88ddab2e1ac39088f2806177982cc62c (patch) | |
tree | 16af8bb02d53d727c06f64852d71b20786294577 /include/libfdt.h | |
parent | 3e38577208e4256956bc33bb8bcd0a6b6fab55c3 (diff) |
libfdt: Add function to explicitly expand aliases
Kumar has already added alias expansion to fdt_path_offset().
However, in some circumstances it may be convenient for the user of
libfdt to explicitly get the string expansion of an alias. This patch
adds a function to do this, fdt_get_alias(), and uses it to implement
fdt_path_offset().
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'include/libfdt.h')
-rw-r--r-- | include/libfdt.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/include/libfdt.h b/include/libfdt.h index 5492a53520..7cad68c3ce 100644 --- a/include/libfdt.h +++ b/include/libfdt.h @@ -459,6 +459,32 @@ static inline void *fdt_getprop_w(void *fdt, int nodeoffset, uint32_t fdt_get_phandle(const void *fdt, int nodeoffset); /** + * fdt_get_namelen - get alias based on substring + * @fdt: pointer to the device tree blob + * @name: name of the alias th look up + * @namelen: number of characters of name to consider + * + * Identical to fdt_get_alias(), but only examine the first namelen + * characters of name for matching the alias name. + */ +const char *fdt_get_alias_namelen(const void *fdt, + const char *name, int namelen); + +/** + * fdt_get_alias - retreive the path referenced by a given alias + * @fdt: pointer to the device tree blob + * @name: name of the alias th look up + * + * fdt_get_alias() retrieves the value of a given alias. That is, the + * value of the property named 'name' in the node /aliases. + * + * returns: + * a pointer to the expansion of the alias named 'name', of it exists + * NULL, if the given alias or the /aliases node does not exist + */ +const char *fdt_get_alias(const void *fdt, const char *name); + +/** * fdt_get_path - determine the full path of a node * @fdt: pointer to the device tree blob * @nodeoffset: offset of the node whose path to find |