aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/da9052-regulator.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-04-04 00:50:22 +0100
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-04-09 12:37:09 +0100
commitc172708d38a401b2f3f841dfcd862b469fa0b670 (patch)
tree75e89c63fd0c76a2c69bb5ad6e45b3762bceb6b6 /drivers/regulator/da9052-regulator.c
parentMerge branch 'regulator-register' into regulator-drivers (diff)
downloadlinux-dev-c172708d38a401b2f3f841dfcd862b469fa0b670.tar.xz
linux-dev-c172708d38a401b2f3f841dfcd862b469fa0b670.zip
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/da9052-regulator.c')
-rw-r--r--drivers/regulator/da9052-regulator.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/regulator/da9052-regulator.c b/drivers/regulator/da9052-regulator.c
index 83e489f76a90..b6c8c4be83c9 100644
--- a/drivers/regulator/da9052-regulator.c
+++ b/drivers/regulator/da9052-regulator.c
@@ -403,6 +403,7 @@ static inline struct da9052_regulator_info *find_regulator_info(u8 chip_id,
static int __devinit da9052_regulator_probe(struct platform_device *pdev)
{
+ struct regulator_config config = { };
struct da9052_regulator *regulator;
struct da9052 *da9052;
struct da9052_pdata *pdata;
@@ -422,10 +423,13 @@ static int __devinit da9052_regulator_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "invalid regulator ID specified\n");
return -EINVAL;
}
+
+ config.dev = &pdev->dev;
+ config.init_data = pdata->regulators[pdev->id];
+ config.driver_data = regulator;
+
regulator->rdev = regulator_register(&regulator->info->reg_desc,
- &pdev->dev,
- pdata->regulators[pdev->id],
- regulator, NULL);
+ &config);
if (IS_ERR(regulator->rdev)) {
dev_err(&pdev->dev, "failed to register regulator %s\n",
regulator->info->reg_desc.name);