regulator: gpio-regulator: do not open-code counting and access of dt array elements
authorHeiko Stuebner <heiko.stuebner@bqreaders.com>
Wed, 12 Feb 2014 00:01:08 +0000 (01:01 +0100)
committerSimon Horman <horms@verge.net.au>
Fri, 5 Dec 2014 00:21:40 +0000 (09:21 +0900)
commitb1e0a0aef658dd8159213e9d04fa784edf50c5c3
tree960769ca42482381931c03e45a216d6fdf5826c7
parent906146a3567b287318a4436846f9e092508ead60
regulator: gpio-regulator: do not open-code counting and access of dt array elements

Open coding the counting of elements in a dt-property is abstracted by the newly
introduced of_property_count_uXX_elems functions. Additionally the raw iteration
over the states element exposes the endian conversion and dtb-format details,
which according to Mark Rutland "would be nice to limit [...] to of_ helper
functions".

Thus change gpio-regulator to use the helper for element counting and
of_property_read_u32_index for retrieval of individual values.

This makes it possible to remove the raw access to the states property entirely.

Signed-off-by: Heiko Stuebner <heiko.stuebner@bqreaders.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 934624d6e9f0b3d41557c4105c286e8daeaadb4e)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
drivers/regulator/gpio-regulator.c