aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2013-01-30 07:54:49 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-01-31 01:43:32 -0500
commit86f6673325e38274c55f3df9f919d9a618f100d4 (patch)
tree8bf9cce53f1b13efd58d51287f251ad49deb5ee3 /drivers/regulator
parentee70b258498174ba50b346960763203b7cba9d4a (diff)
regulator: mc13xxx: Use of_get_child_count()
Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/mc13xxx-regulator-core.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/regulator/mc13xxx-regulator-core.c b/drivers/regulator/mc13xxx-regulator-core.c
index 5d2ab2ea0c8c..23cf9f9c383b 100644
--- a/drivers/regulator/mc13xxx-regulator-core.c
+++ b/drivers/regulator/mc13xxx-regulator-core.c
@@ -164,17 +164,15 @@ EXPORT_SYMBOL_GPL(mc13xxx_fixed_regulator_ops);
164#ifdef CONFIG_OF 164#ifdef CONFIG_OF
165int mc13xxx_get_num_regulators_dt(struct platform_device *pdev) 165int mc13xxx_get_num_regulators_dt(struct platform_device *pdev)
166{ 166{
167 struct device_node *parent, *child; 167 struct device_node *parent;
168 int num = 0; 168 int num;
169 169
170 of_node_get(pdev->dev.parent->of_node); 170 of_node_get(pdev->dev.parent->of_node);
171 parent = of_find_node_by_name(pdev->dev.parent->of_node, "regulators"); 171 parent = of_find_node_by_name(pdev->dev.parent->of_node, "regulators");
172 if (!parent) 172 if (!parent)
173 return -ENODEV; 173 return -ENODEV;
174 174
175 for_each_child_of_node(parent, child) 175 num = of_get_child_count(parent);
176 num++;
177
178 of_node_put(parent); 176 of_node_put(parent);
179 return num; 177 return num;
180} 178}