aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/ab3100.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/ab3100.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/ab3100.c')
-rw-r--r--drivers/regulator/ab3100.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/regulator/ab3100.c b/drivers/regulator/ab3100.c
index ed56c9352e6f..ce6192592ca2 100644
--- a/drivers/regulator/ab3100.c
+++ b/drivers/regulator/ab3100.c
@@ -574,6 +574,7 @@ ab3100_regulator_desc[AB3100_NUM_REGULATORS] = {
574static int __devinit ab3100_regulators_probe(struct platform_device *pdev) 574static int __devinit ab3100_regulators_probe(struct platform_device *pdev)
575{ 575{
576 struct ab3100_platform_data *plfdata = pdev->dev.platform_data; 576 struct ab3100_platform_data *plfdata = pdev->dev.platform_data;
577 struct regulator_config config = { };
577 int err = 0; 578 int err = 0;
578 u8 data; 579 u8 data;
579 int i; 580 int i;
@@ -619,15 +620,15 @@ static int __devinit ab3100_regulators_probe(struct platform_device *pdev)
619 reg->dev = &pdev->dev; 620 reg->dev = &pdev->dev;
620 reg->plfdata = plfdata; 621 reg->plfdata = plfdata;
621 622
623 config.dev = &pdev->dev;
624 config.driver_data = reg;
625 config.init_data = &plfdata->reg_constraints[i];
626
622 /* 627 /*
623 * Register the regulator, pass around 628 * Register the regulator, pass around
624 * the ab3100_regulator struct 629 * the ab3100_regulator struct
625 */ 630 */
626 rdev = regulator_register(&ab3100_regulator_desc[i], 631 rdev = regulator_register(&ab3100_regulator_desc[i], &config);
627 &pdev->dev,
628 &plfdata->reg_constraints[i],
629 reg, NULL);
630
631 if (IS_ERR(rdev)) { 632 if (IS_ERR(rdev)) {
632 err = PTR_ERR(rdev); 633 err = PTR_ERR(rdev);
633 dev_err(&pdev->dev, 634 dev_err(&pdev->dev,