summaryrefslogtreecommitdiff
path: root/include/libfdt.h
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2014-08-26 17:33:51 +0200
committerSimon Glass <sjg@chromium.org>2014-10-22 16:56:40 -0600
commitfc503c1791f35294d04495cd8ba3794bb6f15055 (patch)
tree533bf4e7806abd8a90b41e8ec6a7c7390fe8d47f /include/libfdt.h
parentbc4147ab2d698bf7375a10af73ce34d76129edff (diff)
downloadu-boot-imx-fc503c1791f35294d04495cd8ba3794bb6f15055.zip
u-boot-imx-fc503c1791f35294d04495cd8ba3794bb6f15055.tar.gz
u-boot-imx-fc503c1791f35294d04495cd8ba3794bb6f15055.tar.bz2
fdt: Add a function to get the index of a string
Given a device tree node and a property name, the new fdt_find_string() function will look up a given string in the string list contained in the property's value and return its index. Signed-off-by: Thierry Reding <treding@nvidia.com> Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/libfdt.h')
-rw-r--r--include/libfdt.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/libfdt.h b/include/libfdt.h
index cf97bf0..d0dea66 100644
--- a/include/libfdt.h
+++ b/include/libfdt.h
@@ -866,6 +866,17 @@ int fdt_stringlist_contains(const char *strlist, int listlen, const char *str);
*/
int fdt_count_strings(const void *fdt, int node, const char *property);
+/**
+ * fdt_find_string - find a string in a string list and return its index
+ * @fdt: pointer to the device tree blob
+ * @node: offset of the node
+ * @property: name of the property containing the string list
+ * @string: string to look up in the string list
+ * @return: the index of the string or negative on error
+ */
+int fdt_find_string(const void *fdt, int node, const char *property,
+ const char *string);
+
/**********************************************************************/
/* Read-only functions (addressing related) */
/**********************************************************************/