aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/aat2870-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/aat2870-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/aat2870-regulator.c')
-rw-r--r--drivers/regulator/aat2870-regulator.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/regulator/aat2870-regulator.c b/drivers/regulator/aat2870-regulator.c
index 7cc380e950f6..7f000d6bb984 100644
--- a/drivers/regulator/aat2870-regulator.c
+++ b/drivers/regulator/aat2870-regulator.c
@@ -178,6 +178,7 @@ static struct aat2870_regulator *aat2870_get_regulator(int id)
178static int aat2870_regulator_probe(struct platform_device *pdev) 178static int aat2870_regulator_probe(struct platform_device *pdev)
179{ 179{
180 struct aat2870_regulator *ri; 180 struct aat2870_regulator *ri;
181 struct regulator_config config = { 0 };
181 struct regulator_dev *rdev; 182 struct regulator_dev *rdev;
182 183
183 ri = aat2870_get_regulator(pdev->id); 184 ri = aat2870_get_regulator(pdev->id);
@@ -187,8 +188,11 @@ static int aat2870_regulator_probe(struct platform_device *pdev)
187 } 188 }
188 ri->aat2870 = dev_get_drvdata(pdev->dev.parent); 189 ri->aat2870 = dev_get_drvdata(pdev->dev.parent);
189 190
190 rdev = regulator_register(&ri->desc, &pdev->dev, 191 config.dev = &pdev->dev;
191 pdev->dev.platform_data, ri, NULL); 192 config.driver_data = ri;
193 config.init_data = pdev->dev.platform_data;
194
195 rdev = regulator_register(&ri->desc, &config);
192 if (IS_ERR(rdev)) { 196 if (IS_ERR(rdev)) {
193 dev_err(&pdev->dev, "Failed to register regulator %s\n", 197 dev_err(&pdev->dev, "Failed to register regulator %s\n",
194 ri->desc.name); 198 ri->desc.name);