aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/ab8500.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/ab8500.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/ab8500.c')
-rw-r--r--drivers/regulator/ab8500.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c
index 0d095b6e567a..93feadaf40c0 100644
--- a/drivers/regulator/ab8500.c
+++ b/drivers/regulator/ab8500.c
@@ -712,6 +712,7 @@ static __devinit int ab8500_regulator_probe(struct platform_device *pdev)
712{ 712{
713 struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent); 713 struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent);
714 struct ab8500_platform_data *pdata; 714 struct ab8500_platform_data *pdata;
715 struct regulator_config config = { };
715 int i, err; 716 int i, err;
716 717
717 if (!ab8500) { 718 if (!ab8500) {
@@ -779,6 +780,10 @@ static __devinit int ab8500_regulator_probe(struct platform_device *pdev)
779 info = &ab8500_regulator_info[i]; 780 info = &ab8500_regulator_info[i];
780 info->dev = &pdev->dev; 781 info->dev = &pdev->dev;
781 782
783 config->dev = &pdev->dev;
784 config->init_data = &pdata->regulator[i];
785 config->driver_data = info;
786
782 /* fix for hardware before ab8500v2.0 */ 787 /* fix for hardware before ab8500v2.0 */
783 if (abx500_get_chip_id(info->dev) < 0x20) { 788 if (abx500_get_chip_id(info->dev) < 0x20) {
784 if (info->desc.id == AB8500_LDO_AUX3) { 789 if (info->desc.id == AB8500_LDO_AUX3) {
@@ -792,8 +797,7 @@ static __devinit int ab8500_regulator_probe(struct platform_device *pdev)
792 } 797 }
793 798
794 /* register regulator with framework */ 799 /* register regulator with framework */
795 info->regulator = regulator_register(&info->desc, &pdev->dev, 800 info->regulator = regulator_register(&info->desc, &config);
796 &pdata->regulator[i], info, NULL);
797 if (IS_ERR(info->regulator)) { 801 if (IS_ERR(info->regulator)) {
798 err = PTR_ERR(info->regulator); 802 err = PTR_ERR(info->regulator);
799 dev_err(&pdev->dev, "failed to register regulator %s\n", 803 dev_err(&pdev->dev, "failed to register regulator %s\n",