From eb0d8e7a14041e30f74f63dca12e0f49ee0bec39 Mon Sep 17 00:00:00 2001 From: Alexander Shiyan Date: Sat, 27 Apr 2013 10:29:24 +0400 Subject: regulator: mc13xxx: Add warning of incorrect names of regulators This patch adds a warning about incorrect regulators instead of printing the names of non-information message about the wrong amount. Signed-off-by: Alexander Shiyan Signed-off-by: Mark Brown --- drivers/regulator/mc13xxx-regulator-core.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'drivers/regulator/mc13xxx-regulator-core.c') diff --git a/drivers/regulator/mc13xxx-regulator-core.c b/drivers/regulator/mc13xxx-regulator-core.c index 23cf9f9c383b..da4859282302 100644 --- a/drivers/regulator/mc13xxx-regulator-core.c +++ b/drivers/regulator/mc13xxx-regulator-core.c @@ -180,15 +180,13 @@ EXPORT_SYMBOL_GPL(mc13xxx_get_num_regulators_dt); struct mc13xxx_regulator_init_data *mc13xxx_parse_regulators_dt( struct platform_device *pdev, struct mc13xxx_regulator *regulators, - int num_regulators, int *num_parsed) + int num_regulators) { struct mc13xxx_regulator_priv *priv = platform_get_drvdata(pdev); struct mc13xxx_regulator_init_data *data, *p; struct device_node *parent, *child; int i, parsed = 0; - *num_parsed = 0; - of_node_get(pdev->dev.parent->of_node); parent = of_find_node_by_name(pdev->dev.parent->of_node, "regulators"); if (!parent) @@ -204,10 +202,13 @@ struct mc13xxx_regulator_init_data *mc13xxx_parse_regulators_dt( p = data; for_each_child_of_node(parent, child) { + int found = 0; + for (i = 0; i < num_regulators; i++) { + if (!regulators[i].desc.name) + continue; if (!of_node_cmp(child->name, regulators[i].desc.name)) { - p->id = i; p->init_data = of_get_regulator_init_data( &pdev->dev, child); @@ -215,13 +216,19 @@ struct mc13xxx_regulator_init_data *mc13xxx_parse_regulators_dt( p++; parsed++; + found = 1; break; } } + + if (!found) + dev_warn(&pdev->dev, + "Unknown regulator: %s\n", child->name); } of_node_put(parent); - *num_parsed = parsed; + priv->num_regulators = parsed; + return data; } EXPORT_SYMBOL_GPL(mc13xxx_parse_regulators_dt); -- cgit v1.2.3