of: add functions to count number of elements in a property
authorHeiko Stuebner <heiko.stuebner@bqreaders.com>
Wed, 12 Feb 2014 00:00:34 +0000 (01:00 +0100)
committerStephane Desneux <stephane.desneux@open.eurogiciel.org>
Wed, 4 Feb 2015 10:13:26 +0000 (11:13 +0100)
commitfc723d7f71c24450c3304484676d0684abe4f0cd
tree252f0d5b7e97a9f504013260786de3462e3bb42b
parentef8e07da0ff067e60d8d215f2c4cc1467d67a744
of: add functions to count number of elements in a property

The need to know the number of array elements in a property is
a common pattern. To prevent duplication of open-coded implementations
add a helper static function that also centralises strict sanity
checking and DTB format details, as well as a set of wrapper functions
for u8, u16, u32 and u64.

Suggested-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Heiko Stuebner <heiko.stuebner@bqreaders.com>
Acked-by: Rob Herring <robh@kernel.org>
Acked-by: Grant Likely <grant.likely@linaro.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit ad54a0cfbeb4bd4033d09017557ccbc423f9d5ff)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
drivers/of/base.c
include/linux/of.h