summaryrefslogtreecommitdiff
path: root/include/linux/of.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/of.h')
-rw-r--r--include/linux/of.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/of.h b/include/linux/of.h
index ef7aba8108da..ec7b6b60c3bd 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -559,6 +559,19 @@ static inline int of_property_read_u32(const struct device_node *np,
return of_property_read_u32_array(np, propname, out_value, 1);
}
+static inline int of_property_count_u32(const struct device_node *np,
+ const char *propname)
+{
+ const void *prop_ptr;
+ int prop_len;
+
+ prop_ptr = of_get_property(np, propname, &prop_len);
+ if (!prop_ptr)
+ return -EINVAL;
+
+ return prop_len / sizeof(u32);
+}
+
static inline int of_property_read_s32(const struct device_node *np,
const char *propname,
s32 *out_value)