diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-04-03 19:50:22 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-04-09 07:37:09 -0400 |
commit | c172708d38a401b2f3f841dfcd862b469fa0b670 (patch) | |
tree | 75e89c63fd0c76a2c69bb5ad6e45b3762bceb6b6 /drivers/regulator/max8925-regulator.c | |
parent | 1474e4dbcae04125ed6e503eadcef266846f4675 (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/max8925-regulator.c')
-rw-r--r-- | drivers/regulator/max8925-regulator.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/regulator/max8925-regulator.c b/drivers/regulator/max8925-regulator.c index a62f3b5cc312..de30ea2b80f5 100644 --- a/drivers/regulator/max8925-regulator.c +++ b/drivers/regulator/max8925-regulator.c | |||
@@ -258,6 +258,7 @@ static int __devinit max8925_regulator_probe(struct platform_device *pdev) | |||
258 | { | 258 | { |
259 | struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent); | 259 | struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent); |
260 | struct max8925_platform_data *pdata = chip->dev->platform_data; | 260 | struct max8925_platform_data *pdata = chip->dev->platform_data; |
261 | struct regulator_config config = { }; | ||
261 | struct max8925_regulator_info *ri; | 262 | struct max8925_regulator_info *ri; |
262 | struct regulator_dev *rdev; | 263 | struct regulator_dev *rdev; |
263 | 264 | ||
@@ -269,8 +270,11 @@ static int __devinit max8925_regulator_probe(struct platform_device *pdev) | |||
269 | ri->i2c = chip->i2c; | 270 | ri->i2c = chip->i2c; |
270 | ri->chip = chip; | 271 | ri->chip = chip; |
271 | 272 | ||
272 | rdev = regulator_register(&ri->desc, &pdev->dev, | 273 | config.dev = &pdev->dev; |
273 | pdata->regulator[pdev->id], ri, NULL); | 274 | config.init_data = pdata->regulator[pdev->id]; |
275 | config.driver_data = ri; | ||
276 | |||
277 | rdev = regulator_register(&ri->desc, &config); | ||
274 | if (IS_ERR(rdev)) { | 278 | if (IS_ERR(rdev)) { |
275 | dev_err(&pdev->dev, "failed to register regulator %s\n", | 279 | dev_err(&pdev->dev, "failed to register regulator %s\n", |
276 | ri->desc.name); | 280 | ri->desc.name); |