[PATCH 1/4] regulator: bd718x7 initialize regulator config only once

From: Matti Vaittinen
Date: Thu Sep 03 2020 - 14:38:34 EST


The BD718x7 driver initialized common configs for all regulators.
Simplify initialization by moving the initialization of common configs
out of the loop.

Signed-off-by: Matti Vaittinen <matti.vaittinen@xxxxxxxxxxxxxxxxx>
---
drivers/regulator/bd718x7-regulator.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/bd718x7-regulator.c b/drivers/regulator/bd718x7-regulator.c
index 7b311389f925..a72031595b9e 100644
--- a/drivers/regulator/bd718x7-regulator.c
+++ b/drivers/regulator/bd718x7-regulator.c
@@ -1319,6 +1319,9 @@ static int bd718xx_probe(struct platform_device *pdev)
}
}

+ config.dev = pdev->dev.parent;
+ config.regmap = mfd->chip.regmap;
+
for (i = 0; i < num_reg_data; i++) {

const struct regulator_desc *desc;
@@ -1328,8 +1331,6 @@ static int bd718xx_probe(struct platform_device *pdev)
r = &reg_data[i];
desc = &r->desc;

- config.dev = pdev->dev.parent;
- config.regmap = mfd->chip.regmap;

rdev = devm_regulator_register(&pdev->dev, desc, &config);
if (IS_ERR(rdev)) {
--
2.21.0


--
Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND

~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~
Simon says - in Latin please.
~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~
Thanks to Simon Glass for the translation =]