aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/s5m8767.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/s5m8767.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/s5m8767.c')
-rw-r--r--drivers/regulator/s5m8767.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c
index a2afc0edc5a4..10c38f9ae787 100644
--- a/drivers/regulator/s5m8767.c
+++ b/drivers/regulator/s5m8767.c
@@ -579,6 +579,7 @@ static __devinit int s5m8767_pmic_probe(struct platform_device *pdev)
579{ 579{
580 struct s5m87xx_dev *iodev = dev_get_drvdata(pdev->dev.parent); 580 struct s5m87xx_dev *iodev = dev_get_drvdata(pdev->dev.parent);
581 struct s5m_platform_data *pdata = dev_get_platdata(iodev->dev); 581 struct s5m_platform_data *pdata = dev_get_platdata(iodev->dev);
582 struct regulator_config config = { };
582 struct regulator_dev **rdev; 583 struct regulator_dev **rdev;
583 struct s5m8767_info *s5m8767; 584 struct s5m8767_info *s5m8767;
584 int i, ret, size; 585 int i, ret, size;
@@ -774,8 +775,11 @@ static __devinit int s5m8767_pmic_probe(struct platform_device *pdev)
774 regulators[id].n_voltages = 775 regulators[id].n_voltages =
775 (desc->max - desc->min) / desc->step + 1; 776 (desc->max - desc->min) / desc->step + 1;
776 777
777 rdev[i] = regulator_register(&regulators[id], s5m8767->dev, 778 config.dev = s5m8767->dev;
778 pdata->regulators[i].initdata, s5m8767, NULL); 779 config.init_data = pdata->regulators[i].initdata;
780 config.driver_data = s5m8767;
781
782 rdev[i] = regulator_register(&regulators[id], &config);
779 if (IS_ERR(rdev[i])) { 783 if (IS_ERR(rdev[i])) {
780 ret = PTR_ERR(rdev[i]); 784 ret = PTR_ERR(rdev[i]);
781 dev_err(s5m8767->dev, "regulator init failed for %d\n", 785 dev_err(s5m8767->dev, "regulator init failed for %d\n",