dm: core: add ofnode_count_phandle_with_args()
authorPatrice Chotard <patrice.chotard@st.com>
Tue, 18 Jul 2017 09:57:08 +0000 (11:57 +0200)
committerMarek Vasut <marex@denx.de>
Fri, 28 Jul 2017 21:34:08 +0000 (23:34 +0200)
commit642346ae269c3c5c54cf7e15c426c42f4df031da
tree2ca4b749f8fe2965314dcde27c388c7eb4ce5ff2
parent82a8a669b4f7159f1f3c3251c2fcb36965896290
dm: core: add ofnode_count_phandle_with_args()

This function is usefull to get phandle number contained
in a property list.
For example,  this allows to allocate the right amount
of memory to keep clock's reference contained into the
"clocks" property.

To implement it, either of_count_phandle_with_args() or
fdtdec_parse_phandle_with_args() are used respectively
for live tree and flat tree.
By passing index = -1, these 2 functions returns the
number of phandle contained into the property list.

Add also the dev_count_phandle_with_args() based on
ofnode_count_phandle_with_args()

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/core/of_access.c
drivers/core/ofnode.c
include/dm/of_access.h
include/dm/ofnode.h
include/dm/read.h