aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/tps65912-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/tps65912-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/tps65912-regulator.c')
-rw-r--r--drivers/regulator/tps65912-regulator.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/regulator/tps65912-regulator.c b/drivers/regulator/tps65912-regulator.c
index 05ea096cf8a7..8c9c61383fee 100644
--- a/drivers/regulator/tps65912-regulator.c
+++ b/drivers/regulator/tps65912-regulator.c
@@ -463,6 +463,7 @@ static struct regulator_ops tps65912_ops_ldo = {
463static __devinit int tps65912_probe(struct platform_device *pdev) 463static __devinit int tps65912_probe(struct platform_device *pdev)
464{ 464{
465 struct tps65912 *tps65912 = dev_get_drvdata(pdev->dev.parent); 465 struct tps65912 *tps65912 = dev_get_drvdata(pdev->dev.parent);
466 struct regulator_config config = { };
466 struct tps_info *info; 467 struct tps_info *info;
467 struct regulator_init_data *reg_data; 468 struct regulator_init_data *reg_data;
468 struct regulator_dev *rdev; 469 struct regulator_dev *rdev;
@@ -500,8 +501,12 @@ static __devinit int tps65912_probe(struct platform_device *pdev)
500 pmic->desc[i].type = REGULATOR_VOLTAGE; 501 pmic->desc[i].type = REGULATOR_VOLTAGE;
501 pmic->desc[i].owner = THIS_MODULE; 502 pmic->desc[i].owner = THIS_MODULE;
502 range = tps65912_get_range(pmic, i); 503 range = tps65912_get_range(pmic, i);
503 rdev = regulator_register(&pmic->desc[i], 504
504 tps65912->dev, reg_data, pmic, NULL); 505 config.dev = tps65912->dev;
506 config.init_data = reg_data;
507 config.driver_data = pmic;
508
509 rdev = regulator_register(&pmic->desc[i], &config);
505 if (IS_ERR(rdev)) { 510 if (IS_ERR(rdev)) {
506 dev_err(tps65912->dev, 511 dev_err(tps65912->dev,
507 "failed to register %s regulator\n", 512 "failed to register %s regulator\n",