aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/wm8994-regulator.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-04-03 19:50:22 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-04-09 07:37:09 -0400
commitc172708d38a401b2f3f841dfcd862b469fa0b670 (patch)
tree75e89c63fd0c76a2c69bb5ad6e45b3762bceb6b6 /drivers/regulator/wm8994-regulator.c
parent1474e4dbcae04125ed6e503eadcef266846f4675 (diff)
regulator: core: Use a struct to pass in regulator runtime configuration
Rather than adding new arguments to regulator_register() every time we want to add a new bit of dynamic information at runtime change the function to take these via a struct. By doing this we avoid needing to do further changes like the recent addition of device tree support which required each regulator driver to be updated to take an additional parameter. The regulator_desc which should (mostly) be static data is still passed separately as most drivers are able to configure this statically at build time. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/wm8994-regulator.c')
-rw-r--r--drivers/regulator/wm8994-regulator.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/regulator/wm8994-regulator.c b/drivers/regulator/wm8994-regulator.c
index 8a4897a35f28..f4a62941b711 100644
--- a/drivers/regulator/wm8994-regulator.c
+++ b/drivers/regulator/wm8994-regulator.c
@@ -233,6 +233,7 @@ static __devinit int wm8994_ldo_probe(struct platform_device *pdev)
233 struct wm8994 *wm8994 = dev_get_drvdata(pdev->dev.parent); 233 struct wm8994 *wm8994 = dev_get_drvdata(pdev->dev.parent);
234 struct wm8994_pdata *pdata = wm8994->dev->platform_data; 234 struct wm8994_pdata *pdata = wm8994->dev->platform_data;
235 int id = pdev->id % ARRAY_SIZE(pdata->ldo); 235 int id = pdev->id % ARRAY_SIZE(pdata->ldo);
236 struct regulator_config config = { };
236 struct wm8994_ldo *ldo; 237 struct wm8994_ldo *ldo;
237 int ret; 238 int ret;
238 239
@@ -268,8 +269,11 @@ static __devinit int wm8994_ldo_probe(struct platform_device *pdev)
268 } else 269 } else
269 ldo->is_enabled = true; 270 ldo->is_enabled = true;
270 271
271 ldo->regulator = regulator_register(&wm8994_ldo_desc[id], &pdev->dev, 272 config.dev = &pdev->dev;
272 pdata->ldo[id].init_data, ldo, NULL); 273 config.init_data = pdata->ldo[id].init_data;
274 config.driver_data = ldo;
275
276 ldo->regulator = regulator_register(&wm8994_ldo_desc[id], &config);
273 if (IS_ERR(ldo->regulator)) { 277 if (IS_ERR(ldo->regulator)) {
274 ret = PTR_ERR(ldo->regulator); 278 ret = PTR_ERR(ldo->regulator);
275 dev_err(wm8994->dev, "Failed to register LDO%d: %d\n", 279 dev_err(wm8994->dev, "Failed to register LDO%d: %d\n",