summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2017-06-12 06:21:28 -0600
committerSimon Glass <sjg@chromium.org>2017-07-11 10:08:20 -0600
commit8c293d6ac9c9f698a2b5db8def9d1cef725b5011 (patch)
treeb1e0018844e958ca5e9eb65e1366071cff79db45 /drivers
parent7feccfdc45d5708ffd682a025d6d6e8907f1a97a (diff)
dm: core: Add ofnode_read_string_count()
This provides a way to find the number of strings in a string list. Add it and also fix up the comment for ofnode_read_string_index(). Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> Tested-on: Beaver, Jetson-TK1
Diffstat (limited to 'drivers')
-rw-r--r--drivers/core/ofnode.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index ac312d6546..79c80df7f4 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -260,6 +260,16 @@ int ofnode_read_string_index(ofnode node, const char *property, int index,
}
}
+int ofnode_read_string_count(ofnode node, const char *property)
+{
+ if (ofnode_is_np(node)) {
+ return of_property_count_strings(ofnode_to_np(node), property);
+ } else {
+ return fdt_stringlist_count(gd->fdt_blob,
+ ofnode_to_offset(node), property);
+ }
+}
+
static void ofnode_from_fdtdec_phandle_args(struct fdtdec_phandle_args *in,
struct ofnode_phandle_args *out)
{