diff options
author | Laxman Dewangan <ldewangan@nvidia.com> | 2014-02-05 17:42:02 +0530 |
---|---|---|
committer | Laxman Dewangan <ldewangan@nvidia.com> | 2014-02-06 04:50:09 -0800 |
commit | 63bf6fb9963f0864d74718c74974bbcd4b491ff0 (patch) | |
tree | 802eb9a5afc05c1266d499a6e2e388fb53812d63 /include/linux/of.h | |
parent | e707c02fc0384db4ed2245988390d354e380ef6e (diff) |
linux: of: add api to get count of u32 array
Add generic API to get the value count of u32 type array
from given property.
This helps of reading array data.
Change-Id: I12fab0c582df78720adf75f0bc91ba7505e63d22
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/363839
(cherry picked from commit a81f3da06f745fc9423b95fa624aadebf0cdf3dc)
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Change-Id: Ie91ad9a7983c134e1448e3386453f0b9ac11baac
Reviewed-on: http://git-master/r/364219
Diffstat (limited to 'include/linux/of.h')
-rw-r--r-- | include/linux/of.h | 13 |
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) |