From 8c293d6ac9c9f698a2b5db8def9d1cef725b5011 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 12 Jun 2017 06:21:28 -0600 Subject: 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 Tested-by: Marcel Ziswiler Tested-on: Beaver, Jetson-TK1 --- drivers/core/ofnode.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'drivers/core') 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) { -- cgit