aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/gpio-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/gpio-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/gpio-regulator.c')
-rw-r--r--drivers/regulator/gpio-regulator.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c
index ad0fc78c3cb4..f93b06b1e7ec 100644
--- a/drivers/regulator/gpio-regulator.c
+++ b/drivers/regulator/gpio-regulator.c
@@ -172,6 +172,7 @@ static int __devinit gpio_regulator_probe(struct platform_device *pdev)
172{ 172{
173 struct gpio_regulator_config *config = pdev->dev.platform_data; 173 struct gpio_regulator_config *config = pdev->dev.platform_data;
174 struct gpio_regulator_data *drvdata; 174 struct gpio_regulator_data *drvdata;
175 struct regulator_config cfg = { };
175 int ptr, ret, state; 176 int ptr, ret, state;
176 177
177 drvdata = devm_kzalloc(&pdev->dev, sizeof(struct gpio_regulator_data), 178 drvdata = devm_kzalloc(&pdev->dev, sizeof(struct gpio_regulator_data),
@@ -284,8 +285,11 @@ static int __devinit gpio_regulator_probe(struct platform_device *pdev)
284 } 285 }
285 drvdata->state = state; 286 drvdata->state = state;
286 287
287 drvdata->dev = regulator_register(&drvdata->desc, &pdev->dev, 288 cfg.dev = &pdev->dev;
288 config->init_data, drvdata, NULL); 289 cfg.init_data = config->init_data;
290 cfg.driver_data = &drvdata;
291
292 drvdata->dev = regulator_register(&drvdata->desc, &cfg);
289 if (IS_ERR(drvdata->dev)) { 293 if (IS_ERR(drvdata->dev)) {
290 ret = PTR_ERR(drvdata->dev); 294 ret = PTR_ERR(drvdata->dev);
291 dev_err(&pdev->dev, "Failed to register regulator: %d\n", ret); 295 dev_err(&pdev->dev, "Failed to register regulator: %d\n", ret);