summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2014-08-26 17:33:52 +0200
committerMarcel Ziswiler <marcel.ziswiler@toradex.com>2014-10-11 01:06:35 +0200
commitb276b9c1353a6681d85f31885b6ae8c1fe61522f (patch)
tree7402c776a937e62ce1fc230f5337482a9274fef7 /include
parent5b1515b61e35c3ba75be86fe531ab3c3a06145bd (diff)
fdt: Add functions to retrieve strings
Given a device tree node, a property name and an index, the new function fdt_get_string_index() will return in an output argument a pointer to the index'th string in the property's value. The fdt_get_string() is a shortcut for the above with the index being 0. Signed-off-by: Thierry Reding <treding@nvidia.com> Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/libfdt.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/include/libfdt.h b/include/libfdt.h
index d0dea668ee..2dfc6d9e5c 100644
--- a/include/libfdt.h
+++ b/include/libfdt.h
@@ -877,6 +877,33 @@ int fdt_count_strings(const void *fdt, int node, const char *property);
int fdt_find_string(const void *fdt, int node, const char *property,
const char *string);
+/**
+ * fdt_get_string_index() - obtain the string at a given index in a string list
+ * @fdt: pointer to the device tree blob
+ * @node: offset of the node
+ * @property: name of the property containing the string list
+ * @index: index of the string to return
+ * @output: return location for the string
+ * @return: 0 if the string was found or a negative error code otherwise
+ */
+int fdt_get_string_index(const void *fdt, int node, const char *property,
+ int index, const char **output);
+
+/**
+ * fdt_get_string() - obtain the string at a given index in a string list
+ * @fdt: pointer to the device tree blob
+ * @node: offset of the node
+ * @property: name of the property containing the string list
+ * @output: return location for the string
+ * @return: 0 if the string was found or a negative error code otherwise
+ *
+ * This is a shortcut for:
+ *
+ * fdt_get_string_index(fdt, node, property, 0, output).
+ */
+int fdt_get_string(const void *fdt, int node, const char *property,
+ const char **output);
+
/**********************************************************************/
/* Read-only functions (addressing related) */
/**********************************************************************/