aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--drivers/regulator/88pm8607.c8
-rw-r--r--drivers/regulator/aat2870-regulator.c8
-rw-r--r--drivers/regulator/ab3100.c11
-rw-r--r--drivers/regulator/ab8500.c8
-rw-r--r--drivers/regulator/ad5398.c8
-rw-r--r--drivers/regulator/core.c19
-rw-r--r--drivers/regulator/da903x.c8
-rw-r--r--drivers/regulator/da9052-regulator.c10
-rw-r--r--drivers/regulator/db8500-prcmu.c8
-rw-r--r--drivers/regulator/dummy.c6
-rw-r--r--drivers/regulator/fixed.c10
-rw-r--r--drivers/regulator/gpio-regulator.c8
-rw-r--r--drivers/regulator/isl6271a-regulator.c11
-rw-r--r--drivers/regulator/lp3971.c9
-rw-r--r--drivers/regulator/lp3972.c9
-rw-r--r--drivers/regulator/max1586.c10
-rw-r--r--drivers/regulator/max8649.c8
-rw-r--r--drivers/regulator/max8660.c9
-rw-r--r--drivers/regulator/max8925-regulator.c8
-rw-r--r--drivers/regulator/max8952.c8
-rw-r--r--drivers/regulator/max8997.c8
-rw-r--r--drivers/regulator/max8998.c9
-rw-r--r--drivers/regulator/pcap-regulator.c8
-rw-r--r--drivers/regulator/pcf50633-regulator.c8
-rw-r--r--drivers/regulator/rc5t583-regulator.c8
-rw-r--r--drivers/regulator/s5m8767.c8
-rw-r--r--drivers/regulator/tps6105x-regulator.c9
-rw-r--r--drivers/regulator/tps62360-regulator.c8
-rw-r--r--drivers/regulator/tps65023-regulator.c8
-rw-r--r--drivers/regulator/tps6507x-regulator.c8
-rw-r--r--drivers/regulator/tps65090-regulator.c8
-rw-r--r--drivers/regulator/tps65217-regulator.c8
-rw-r--r--drivers/regulator/tps6524x-regulator.c8
-rw-r--r--drivers/regulator/tps6586x-regulator.c8
-rw-r--r--drivers/regulator/tps65910-regulator.c8
-rw-r--r--drivers/regulator/tps65912-regulator.c9
-rw-r--r--drivers/regulator/twl-regulator.c9
-rw-r--r--drivers/regulator/wm831x-dcdc.c32
-rw-r--r--drivers/regulator/wm831x-isink.c8
-rw-r--r--drivers/regulator/wm831x-ldo.c24
-rw-r--r--drivers/regulator/wm8350-regulator.c9
-rw-r--r--drivers/regulator/wm8400-regulator.c7
-rw-r--r--drivers/regulator/wm8994-regulator.c8
-rw-r--r--include/linux/regulator/driver.h31
-rw-r--r--sound/soc/codecs/sgtl5000.c8
45 files changed, 331 insertions, 120 deletions
diff --git a/drivers/regulator/88pm8607.c b/drivers/regulator/88pm8607.c
index 11e5ddd7e796..d04fbe953dd8 100644
--- a/drivers/regulator/88pm8607.c
+++ b/drivers/regulator/88pm8607.c
@@ -365,6 +365,7 @@ static int __devinit pm8607_regulator_probe(struct platform_device *pdev)
365 struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent); 365 struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent);
366 struct pm8607_regulator_info *info = NULL; 366 struct pm8607_regulator_info *info = NULL;
367 struct regulator_init_data *pdata = pdev->dev.platform_data; 367 struct regulator_init_data *pdata = pdev->dev.platform_data;
368 struct regulator_config config = { };
368 struct resource *res; 369 struct resource *res;
369 int i; 370 int i;
370 371
@@ -390,9 +391,12 @@ static int __devinit pm8607_regulator_probe(struct platform_device *pdev)
390 if ((i == PM8607_ID_BUCK3) && info->chip->buck3_double) 391 if ((i == PM8607_ID_BUCK3) && info->chip->buck3_double)
391 info->slope_double = 1; 392 info->slope_double = 1;
392 393
394 config.dev = &pdev->dev;
395 config.init_data = pdata;
396 config.driver_data = info;
397
393 /* replace driver_data with info */ 398 /* replace driver_data with info */
394 info->regulator = regulator_register(&info->desc, &pdev->dev, 399 info->regulator = regulator_register(&info->desc, &config);
395 pdata, info, NULL);
396 if (IS_ERR(info->regulator)) { 400 if (IS_ERR(info->regulator)) {
397 dev_err(&pdev->dev, "failed to register regulator %s\n", 401 dev_err(&pdev->dev, "failed to register regulator %s\n",
398 info->desc.name); 402 info->desc.name);
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);
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,
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",
diff --git a/drivers/regulator/ad5398.c b/drivers/regulator/ad5398.c
index 9ba69c431da8..46d05f38baf8 100644
--- a/drivers/regulator/ad5398.c
+++ b/drivers/regulator/ad5398.c
@@ -212,6 +212,7 @@ static int __devinit ad5398_probe(struct i2c_client *client,
212 const struct i2c_device_id *id) 212 const struct i2c_device_id *id)
213{ 213{
214 struct regulator_init_data *init_data = client->dev.platform_data; 214 struct regulator_init_data *init_data = client->dev.platform_data;
215 struct regulator_config config = { };
215 struct ad5398_chip_info *chip; 216 struct ad5398_chip_info *chip;
216 const struct ad5398_current_data_format *df = 217 const struct ad5398_current_data_format *df =
217 (struct ad5398_current_data_format *)id->driver_data; 218 (struct ad5398_current_data_format *)id->driver_data;
@@ -224,6 +225,10 @@ static int __devinit ad5398_probe(struct i2c_client *client,
224 if (!chip) 225 if (!chip)
225 return -ENOMEM; 226 return -ENOMEM;
226 227
228 config.dev = &client->dev;
229 config.init_data = init_data;
230 config.driver_data = chip;
231
227 chip->client = client; 232 chip->client = client;
228 233
229 chip->min_uA = df->min_uA; 234 chip->min_uA = df->min_uA;
@@ -232,8 +237,7 @@ static int __devinit ad5398_probe(struct i2c_client *client,
232 chip->current_offset = df->current_offset; 237 chip->current_offset = df->current_offset;
233 chip->current_mask = (chip->current_level - 1) << chip->current_offset; 238 chip->current_mask = (chip->current_level - 1) << chip->current_offset;
234 239
235 chip->rdev = regulator_register(&ad5398_reg, &client->dev, 240 chip->rdev = regulator_register(&ad5398_reg, &config);
236 init_data, chip, NULL);
237 if (IS_ERR(chip->rdev)) { 241 if (IS_ERR(chip->rdev)) {
238 ret = PTR_ERR(chip->rdev); 242 ret = PTR_ERR(chip->rdev);
239 dev_err(&client->dev, "failed to register %s %s\n", 243 dev_err(&client->dev, "failed to register %s %s\n",
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index c4b626789f8e..8b9f8602d47b 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2820,27 +2820,24 @@ static void rdev_init_debugfs(struct regulator_dev *rdev)
2820/** 2820/**
2821 * regulator_register - register regulator 2821 * regulator_register - register regulator
2822 * @regulator_desc: regulator to register 2822 * @regulator_desc: regulator to register
2823 * @dev: struct device for the regulator 2823 * @config: runtime configuration for regulator
2824 * @init_data: platform provided init data, passed through by driver
2825 * @driver_data: private regulator data
2826 * @of_node: OpenFirmware node to parse for device tree bindings (may be
2827 * NULL).
2828 * 2824 *
2829 * Called by regulator drivers to register a regulator. 2825 * Called by regulator drivers to register a regulator.
2830 * Returns 0 on success. 2826 * Returns 0 on success.
2831 */ 2827 */
2832struct regulator_dev * 2828struct regulator_dev *
2833regulator_register(const struct regulator_desc *regulator_desc, 2829regulator_register(const struct regulator_desc *regulator_desc,
2834 struct device *dev, const struct regulator_init_data *init_data, 2830 const struct regulator_config *config)
2835 void *driver_data, struct device_node *of_node)
2836{ 2831{
2837 const struct regulation_constraints *constraints = NULL; 2832 const struct regulation_constraints *constraints = NULL;
2833 const struct regulator_init_data *init_data;
2838 static atomic_t regulator_no = ATOMIC_INIT(0); 2834 static atomic_t regulator_no = ATOMIC_INIT(0);
2839 struct regulator_dev *rdev; 2835 struct regulator_dev *rdev;
2836 struct device *dev = config->dev;
2840 int ret, i; 2837 int ret, i;
2841 const char *supply = NULL; 2838 const char *supply = NULL;
2842 2839
2843 if (regulator_desc == NULL) 2840 if (regulator_desc == NULL || config == NULL)
2844 return ERR_PTR(-EINVAL); 2841 return ERR_PTR(-EINVAL);
2845 2842
2846 if (regulator_desc->name == NULL || regulator_desc->ops == NULL) 2843 if (regulator_desc->name == NULL || regulator_desc->ops == NULL)
@@ -2866,6 +2863,8 @@ regulator_register(const struct regulator_desc *regulator_desc,
2866 return ERR_PTR(-EINVAL); 2863 return ERR_PTR(-EINVAL);
2867 } 2864 }
2868 2865
2866 init_data = config->init_data;
2867
2869 rdev = kzalloc(sizeof(struct regulator_dev), GFP_KERNEL); 2868 rdev = kzalloc(sizeof(struct regulator_dev), GFP_KERNEL);
2870 if (rdev == NULL) 2869 if (rdev == NULL)
2871 return ERR_PTR(-ENOMEM); 2870 return ERR_PTR(-ENOMEM);
@@ -2873,7 +2872,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
2873 mutex_lock(&regulator_list_mutex); 2872 mutex_lock(&regulator_list_mutex);
2874 2873
2875 mutex_init(&rdev->mutex); 2874 mutex_init(&rdev->mutex);
2876 rdev->reg_data = driver_data; 2875 rdev->reg_data = config->driver_data;
2877 rdev->owner = regulator_desc->owner; 2876 rdev->owner = regulator_desc->owner;
2878 rdev->desc = regulator_desc; 2877 rdev->desc = regulator_desc;
2879 INIT_LIST_HEAD(&rdev->consumer_list); 2878 INIT_LIST_HEAD(&rdev->consumer_list);
@@ -2890,7 +2889,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
2890 2889
2891 /* register with sysfs */ 2890 /* register with sysfs */
2892 rdev->dev.class = &regulator_class; 2891 rdev->dev.class = &regulator_class;
2893 rdev->dev.of_node = of_node; 2892 rdev->dev.of_node = config->of_node;
2894 rdev->dev.parent = dev; 2893 rdev->dev.parent = dev;
2895 dev_set_name(&rdev->dev, "regulator.%d", 2894 dev_set_name(&rdev->dev, "regulator.%d",
2896 atomic_inc_return(&regulator_no) - 1); 2895 atomic_inc_return(&regulator_no) - 1);
diff --git a/drivers/regulator/da903x.c b/drivers/regulator/da903x.c
index 1851f0929ef0..4630b1ee9966 100644
--- a/drivers/regulator/da903x.c
+++ b/drivers/regulator/da903x.c
@@ -517,6 +517,7 @@ static int __devinit da903x_regulator_probe(struct platform_device *pdev)
517{ 517{
518 struct da903x_regulator_info *ri = NULL; 518 struct da903x_regulator_info *ri = NULL;
519 struct regulator_dev *rdev; 519 struct regulator_dev *rdev;
520 struct regulator_config config = { };
520 521
521 ri = find_regulator_info(pdev->id); 522 ri = find_regulator_info(pdev->id);
522 if (ri == NULL) { 523 if (ri == NULL) {
@@ -536,8 +537,11 @@ static int __devinit da903x_regulator_probe(struct platform_device *pdev)
536 if (ri->desc.id == DA9030_ID_LDO1 || ri->desc.id == DA9030_ID_LDO15) 537 if (ri->desc.id == DA9030_ID_LDO1 || ri->desc.id == DA9030_ID_LDO15)
537 ri->desc.ops = &da9030_regulator_ldo1_15_ops; 538 ri->desc.ops = &da9030_regulator_ldo1_15_ops;
538 539
539 rdev = regulator_register(&ri->desc, &pdev->dev, 540 config.dev = &pdev->dev;
540 pdev->dev.platform_data, ri, NULL); 541 conifg.init_data = pdev->dev.platform_data;
542 config.driver_data = ri;
543
544 rdev = regulator_register(&ri->desc, &config);
541 if (IS_ERR(rdev)) { 545 if (IS_ERR(rdev)) {
542 dev_err(&pdev->dev, "failed to register regulator %s\n", 546 dev_err(&pdev->dev, "failed to register regulator %s\n",
543 ri->desc.name); 547 ri->desc.name);
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,
403 403
404static int __devinit da9052_regulator_probe(struct platform_device *pdev) 404static int __devinit da9052_regulator_probe(struct platform_device *pdev)
405{ 405{
406 struct regulator_config config = { };
406 struct da9052_regulator *regulator; 407 struct da9052_regulator *regulator;
407 struct da9052 *da9052; 408 struct da9052 *da9052;
408 struct da9052_pdata *pdata; 409 struct da9052_pdata *pdata;
@@ -422,10 +423,13 @@ static int __devinit da9052_regulator_probe(struct platform_device *pdev)
422 dev_err(&pdev->dev, "invalid regulator ID specified\n"); 423 dev_err(&pdev->dev, "invalid regulator ID specified\n");
423 return -EINVAL; 424 return -EINVAL;
424 } 425 }
426
427 config.dev = &pdev->dev;
428 config.init_data = pdata->regulators[pdev->id];
429 config.driver_data = regulator;
430
425 regulator->rdev = regulator_register(&regulator->info->reg_desc, 431 regulator->rdev = regulator_register(&regulator->info->reg_desc,
426 &pdev->dev, 432 &config);
427 pdata->regulators[pdev->id],
428 regulator, NULL);
429 if (IS_ERR(regulator->rdev)) { 433 if (IS_ERR(regulator->rdev)) {
430 dev_err(&pdev->dev, "failed to register regulator %s\n", 434 dev_err(&pdev->dev, "failed to register regulator %s\n",
431 regulator->info->reg_desc.name); 435 regulator->info->reg_desc.name);
diff --git a/drivers/regulator/db8500-prcmu.c b/drivers/regulator/db8500-prcmu.c
index 4bd25e75efa0..87b2e83be11c 100644
--- a/drivers/regulator/db8500-prcmu.c
+++ b/drivers/regulator/db8500-prcmu.c
@@ -414,6 +414,7 @@ static int __devinit db8500_regulator_probe(struct platform_device *pdev)
414{ 414{
415 struct regulator_init_data *db8500_init_data = 415 struct regulator_init_data *db8500_init_data =
416 dev_get_platdata(&pdev->dev); 416 dev_get_platdata(&pdev->dev);
417 struct regulator_config config = { };
417 int i, err; 418 int i, err;
418 419
419 /* register all regulators */ 420 /* register all regulators */
@@ -425,9 +426,12 @@ static int __devinit db8500_regulator_probe(struct platform_device *pdev)
425 info = &dbx500_regulator_info[i]; 426 info = &dbx500_regulator_info[i];
426 info->dev = &pdev->dev; 427 info->dev = &pdev->dev;
427 428
429 config.dev = &pdev->dev;
430 config.init_data = init_data;
431 config.driver_data = info;
432
428 /* register with the regulator framework */ 433 /* register with the regulator framework */
429 info->rdev = regulator_register(&info->desc, &pdev->dev, 434 info->rdev = regulator_register(&info->desc, &config);
430 init_data, info, NULL);
431 if (IS_ERR(info->rdev)) { 435 if (IS_ERR(info->rdev)) {
432 err = PTR_ERR(info->rdev); 436 err = PTR_ERR(info->rdev);
433 dev_err(&pdev->dev, "failed to register %s: err %i\n", 437 dev_err(&pdev->dev, "failed to register %s: err %i\n",
diff --git a/drivers/regulator/dummy.c b/drivers/regulator/dummy.c
index 0ee00de4be72..1571bee6b1bc 100644
--- a/drivers/regulator/dummy.c
+++ b/drivers/regulator/dummy.c
@@ -39,10 +39,12 @@ static struct regulator_desc dummy_desc = {
39 39
40static int __devinit dummy_regulator_probe(struct platform_device *pdev) 40static int __devinit dummy_regulator_probe(struct platform_device *pdev)
41{ 41{
42 struct regulator_config config = { };
42 int ret; 43 int ret;
43 44
44 dummy_regulator_rdev = regulator_register(&dummy_desc, NULL, 45 config.init_data = &dummy_initdata;
45 &dummy_initdata, NULL, NULL); 46
47 dummy_regulator_rdev = regulator_register(&dummy_desc, &config);
46 if (IS_ERR(dummy_regulator_rdev)) { 48 if (IS_ERR(dummy_regulator_rdev)) {
47 ret = PTR_ERR(dummy_regulator_rdev); 49 ret = PTR_ERR(dummy_regulator_rdev);
48 pr_err("Failed to register regulator: %d\n", ret); 50 pr_err("Failed to register regulator: %d\n", ret);
diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
index 9a7d70a9c8d7..b47b005a8d28 100644
--- a/drivers/regulator/fixed.c
+++ b/drivers/regulator/fixed.c
@@ -167,6 +167,7 @@ static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev)
167{ 167{
168 struct fixed_voltage_config *config; 168 struct fixed_voltage_config *config;
169 struct fixed_voltage_data *drvdata; 169 struct fixed_voltage_data *drvdata;
170 struct regulator_config cfg = { };
170 int ret; 171 int ret;
171 172
172 if (pdev->dev.of_node) 173 if (pdev->dev.of_node)
@@ -247,9 +248,12 @@ static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev)
247 drvdata->desc.ops = &fixed_voltage_ops; 248 drvdata->desc.ops = &fixed_voltage_ops;
248 } 249 }
249 250
250 drvdata->dev = regulator_register(&drvdata->desc, &pdev->dev, 251 cfg.dev = &pdev->dev;
251 config->init_data, drvdata, 252 cfg.init_data = config->init_data;
252 pdev->dev.of_node); 253 cfg.driver_data = drvdata;
254 cfg.of_node = pdev->dev.of_node;
255
256 drvdata->dev = regulator_register(&drvdata->desc, &cfg);
253 if (IS_ERR(drvdata->dev)) { 257 if (IS_ERR(drvdata->dev)) {
254 ret = PTR_ERR(drvdata->dev); 258 ret = PTR_ERR(drvdata->dev);
255 dev_err(&pdev->dev, "Failed to register regulator: %d\n", ret); 259 dev_err(&pdev->dev, "Failed to register regulator: %d\n", ret);
diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c
index ad0fc78c3cb4..f93b06b1e7ec 100644
--- a/drivers/regulator/gpio-regulator.c
+++ b/drivers/regulator/gpio-regulator.c
@@ -172,6 +172,7 @@ static int __devinit gpio_regulator_probe(struct platform_device *pdev)
172{ 172{
173 struct gpio_regulator_config *config = pdev->dev.platform_data; 173 struct gpio_regulator_config *config = pdev->dev.platform_data;
174 struct gpio_regulator_data *drvdata; 174 struct gpio_regulator_data *drvdata;
175 struct regulator_config cfg = { };
175 int ptr, ret, state; 176 int ptr, ret, state;
176 177
177 drvdata = devm_kzalloc(&pdev->dev, sizeof(struct gpio_regulator_data), 178 drvdata = devm_kzalloc(&pdev->dev, sizeof(struct gpio_regulator_data),
@@ -284,8 +285,11 @@ static int __devinit gpio_regulator_probe(struct platform_device *pdev)
284 } 285 }
285 drvdata->state = state; 286 drvdata->state = state;
286 287
287 drvdata->dev = regulator_register(&drvdata->desc, &pdev->dev, 288 cfg.dev = &pdev->dev;
288 config->init_data, drvdata, NULL); 289 cfg.init_data = config->init_data;
290 cfg.driver_data = &drvdata;
291
292 drvdata->dev = regulator_register(&drvdata->desc, &cfg);
289 if (IS_ERR(drvdata->dev)) { 293 if (IS_ERR(drvdata->dev)) {
290 ret = PTR_ERR(drvdata->dev); 294 ret = PTR_ERR(drvdata->dev);
291 dev_err(&pdev->dev, "Failed to register regulator: %d\n", ret); 295 dev_err(&pdev->dev, "Failed to register regulator: %d\n", ret);
diff --git a/drivers/regulator/isl6271a-regulator.c b/drivers/regulator/isl6271a-regulator.c
index eee6f6b85ebc..863f45a18c30 100644
--- a/drivers/regulator/isl6271a-regulator.c
+++ b/drivers/regulator/isl6271a-regulator.c
@@ -140,6 +140,7 @@ static const struct regulator_desc isl_rd[] = {
140static int __devinit isl6271a_probe(struct i2c_client *i2c, 140static int __devinit isl6271a_probe(struct i2c_client *i2c,
141 const struct i2c_device_id *id) 141 const struct i2c_device_id *id)
142{ 142{
143 struct regulator_config config = { };
143 struct regulator_init_data *init_data = i2c->dev.platform_data; 144 struct regulator_init_data *init_data = i2c->dev.platform_data;
144 struct isl_pmic *pmic; 145 struct isl_pmic *pmic;
145 int err, i; 146 int err, i;
@@ -156,8 +157,14 @@ static int __devinit isl6271a_probe(struct i2c_client *i2c,
156 mutex_init(&pmic->mtx); 157 mutex_init(&pmic->mtx);
157 158
158 for (i = 0; i < 3; i++) { 159 for (i = 0; i < 3; i++) {
159 pmic->rdev[i] = regulator_register(&isl_rd[i], &i2c->dev, 160 config.dev = &i2c->dev;
160 init_data, pmic, NULL); 161 if (i == 0)
162 config.init_data = init_data;
163 else
164 config.init_data = 0;
165 config.driver_data = pmic;
166
167 pmic->rdev[i] = regulator_register(&isl_rd[i], &config);
161 if (IS_ERR(pmic->rdev[i])) { 168 if (IS_ERR(pmic->rdev[i])) {
162 dev_err(&i2c->dev, "failed to register %s\n", id->name); 169 dev_err(&i2c->dev, "failed to register %s\n", id->name);
163 err = PTR_ERR(pmic->rdev[i]); 170 err = PTR_ERR(pmic->rdev[i]);
diff --git a/drivers/regulator/lp3971.c b/drivers/regulator/lp3971.c
index 499986e00fb2..981bea9cb9d7 100644
--- a/drivers/regulator/lp3971.c
+++ b/drivers/regulator/lp3971.c
@@ -421,10 +421,15 @@ static int __devinit setup_regulators(struct lp3971 *lp3971,
421 421
422 /* Instantiate the regulators */ 422 /* Instantiate the regulators */
423 for (i = 0; i < pdata->num_regulators; i++) { 423 for (i = 0; i < pdata->num_regulators; i++) {
424 struct regulator_config config = { };
424 struct lp3971_regulator_subdev *reg = &pdata->regulators[i]; 425 struct lp3971_regulator_subdev *reg = &pdata->regulators[i];
425 lp3971->rdev[i] = regulator_register(&regulators[reg->id],
426 lp3971->dev, reg->initdata, lp3971, NULL);
427 426
427 config.dev = lp3971->dev;
428 config.init_data = reg->initdata;
429 config.driver_data = lp3971;
430
431 lp3971->rdev[i] = regulator_register(&regulators[reg->id],
432 &config);
428 if (IS_ERR(lp3971->rdev[i])) { 433 if (IS_ERR(lp3971->rdev[i])) {
429 err = PTR_ERR(lp3971->rdev[i]); 434 err = PTR_ERR(lp3971->rdev[i]);
430 dev_err(lp3971->dev, "regulator init failed: %d\n", 435 dev_err(lp3971->dev, "regulator init failed: %d\n",
diff --git a/drivers/regulator/lp3972.c b/drivers/regulator/lp3972.c
index fbe3a58a71f2..de073df7d344 100644
--- a/drivers/regulator/lp3972.c
+++ b/drivers/regulator/lp3972.c
@@ -527,9 +527,14 @@ static int __devinit setup_regulators(struct lp3972 *lp3972,
527 /* Instantiate the regulators */ 527 /* Instantiate the regulators */
528 for (i = 0; i < pdata->num_regulators; i++) { 528 for (i = 0; i < pdata->num_regulators; i++) {
529 struct lp3972_regulator_subdev *reg = &pdata->regulators[i]; 529 struct lp3972_regulator_subdev *reg = &pdata->regulators[i];
530 lp3972->rdev[i] = regulator_register(&regulators[reg->id], 530 struct regulator_config config = { };
531 lp3972->dev, reg->initdata, lp3972, NULL); 531
532 config.dev = lp3972->dev;
533 config.init_data = reg->initdata;
534 config.driver_data = lp3972;
532 535
536 lp3972->rdev[i] = regulator_register(&regulators[reg->id],
537 &config);
533 if (IS_ERR(lp3972->rdev[i])) { 538 if (IS_ERR(lp3972->rdev[i])) {
534 err = PTR_ERR(lp3972->rdev[i]); 539 err = PTR_ERR(lp3972->rdev[i]);
535 dev_err(lp3972->dev, "regulator init failed: %d\n", 540 dev_err(lp3972->dev, "regulator init failed: %d\n",
diff --git a/drivers/regulator/max1586.c b/drivers/regulator/max1586.c
index fad0bee10c54..ea832b4ef643 100644
--- a/drivers/regulator/max1586.c
+++ b/drivers/regulator/max1586.c
@@ -185,6 +185,7 @@ static int __devinit max1586_pmic_probe(struct i2c_client *client,
185{ 185{
186 struct regulator_dev **rdev; 186 struct regulator_dev **rdev;
187 struct max1586_platform_data *pdata = client->dev.platform_data; 187 struct max1586_platform_data *pdata = client->dev.platform_data;
188 struct regulator_config config = { };
188 struct max1586_data *max1586; 189 struct max1586_data *max1586;
189 int i, id, ret = -ENOMEM; 190 int i, id, ret = -ENOMEM;
190 191
@@ -212,9 +213,12 @@ static int __devinit max1586_pmic_probe(struct i2c_client *client,
212 dev_err(&client->dev, "invalid regulator id %d\n", id); 213 dev_err(&client->dev, "invalid regulator id %d\n", id);
213 goto err; 214 goto err;
214 } 215 }
215 rdev[i] = regulator_register(&max1586_reg[id], &client->dev, 216
216 pdata->subdevs[i].platform_data, 217 config.dev = &client->dev;
217 max1586, NULL); 218 config.init_data = pdata->subdevs[i].platform_data;
219 config.driver_data = max1586;
220
221 rdev[i] = regulator_register(&max1586_reg[id], &config);
218 if (IS_ERR(rdev[i])) { 222 if (IS_ERR(rdev[i])) {
219 ret = PTR_ERR(rdev[i]); 223 ret = PTR_ERR(rdev[i]);
220 dev_err(&client->dev, "failed to register %s\n", 224 dev_err(&client->dev, "failed to register %s\n",
diff --git a/drivers/regulator/max8649.c b/drivers/regulator/max8649.c
index dca7835b381c..991f517c8dc8 100644
--- a/drivers/regulator/max8649.c
+++ b/drivers/regulator/max8649.c
@@ -225,6 +225,7 @@ static int __devinit max8649_regulator_probe(struct i2c_client *client,
225{ 225{
226 struct max8649_platform_data *pdata = client->dev.platform_data; 226 struct max8649_platform_data *pdata = client->dev.platform_data;
227 struct max8649_regulator_info *info = NULL; 227 struct max8649_regulator_info *info = NULL;
228 struct regulator_config config = { };
228 unsigned int val; 229 unsigned int val;
229 unsigned char data; 230 unsigned char data;
230 int ret; 231 int ret;
@@ -297,8 +298,11 @@ static int __devinit max8649_regulator_probe(struct i2c_client *client,
297 MAX8649_RAMP_DOWN); 298 MAX8649_RAMP_DOWN);
298 } 299 }
299 300
300 info->regulator = regulator_register(&dcdc_desc, &client->dev, 301 config.dev = &client->dev;
301 pdata->regulator, info, NULL); 302 config.init_data = pdata->regulator;
303 config.driver_data = info;
304
305 info->regulator = regulator_register(&dcdc_desc, &config);
302 if (IS_ERR(info->regulator)) { 306 if (IS_ERR(info->regulator)) {
303 dev_err(info->dev, "failed to register regulator %s\n", 307 dev_err(info->dev, "failed to register regulator %s\n",
304 dcdc_desc.name); 308 dcdc_desc.name);
diff --git a/drivers/regulator/max8660.c b/drivers/regulator/max8660.c
index 0e327871fd0e..88f678e4a1a7 100644
--- a/drivers/regulator/max8660.c
+++ b/drivers/regulator/max8660.c
@@ -361,6 +361,7 @@ static int __devinit max8660_probe(struct i2c_client *client,
361{ 361{
362 struct regulator_dev **rdev; 362 struct regulator_dev **rdev;
363 struct max8660_platform_data *pdata = client->dev.platform_data; 363 struct max8660_platform_data *pdata = client->dev.platform_data;
364 struct regulator_config config = { };
364 struct max8660 *max8660; 365 struct max8660 *max8660;
365 int boot_on, i, id, ret = -EINVAL; 366 int boot_on, i, id, ret = -EINVAL;
366 367
@@ -449,9 +450,11 @@ static int __devinit max8660_probe(struct i2c_client *client,
449 450
450 id = pdata->subdevs[i].id; 451 id = pdata->subdevs[i].id;
451 452
452 rdev[i] = regulator_register(&max8660_reg[id], &client->dev, 453 config.dev = &client->dev;
453 pdata->subdevs[i].platform_data, 454 config.init_data = pdata->subdevs[i].platform_data;
454 max8660, NULL); 455 config.driver_data = max8660;
456
457 rdev[i] = regulator_register(&max8660_reg[id], &config);
455 if (IS_ERR(rdev[i])) { 458 if (IS_ERR(rdev[i])) {
456 ret = PTR_ERR(rdev[i]); 459 ret = PTR_ERR(rdev[i]);
457 dev_err(&client->dev, "failed to register %s\n", 460 dev_err(&client->dev, "failed to register %s\n",
diff --git a/drivers/regulator/max8925-regulator.c b/drivers/regulator/max8925-regulator.c
index a62f3b5cc312..de30ea2b80f5 100644
--- a/drivers/regulator/max8925-regulator.c
+++ b/drivers/regulator/max8925-regulator.c
@@ -258,6 +258,7 @@ static int __devinit max8925_regulator_probe(struct platform_device *pdev)
258{ 258{
259 struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent); 259 struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent);
260 struct max8925_platform_data *pdata = chip->dev->platform_data; 260 struct max8925_platform_data *pdata = chip->dev->platform_data;
261 struct regulator_config config = { };
261 struct max8925_regulator_info *ri; 262 struct max8925_regulator_info *ri;
262 struct regulator_dev *rdev; 263 struct regulator_dev *rdev;
263 264
@@ -269,8 +270,11 @@ static int __devinit max8925_regulator_probe(struct platform_device *pdev)
269 ri->i2c = chip->i2c; 270 ri->i2c = chip->i2c;
270 ri->chip = chip; 271 ri->chip = chip;
271 272
272 rdev = regulator_register(&ri->desc, &pdev->dev, 273 config.dev = &pdev->dev;
273 pdata->regulator[pdev->id], ri, NULL); 274 config.init_data = pdata->regulator[pdev->id];
275 config.driver_data = ri;
276
277 rdev = regulator_register(&ri->desc, &config);
274 if (IS_ERR(rdev)) { 278 if (IS_ERR(rdev)) {
275 dev_err(&pdev->dev, "failed to register regulator %s\n", 279 dev_err(&pdev->dev, "failed to register regulator %s\n",
276 ri->desc.name); 280 ri->desc.name);
diff --git a/drivers/regulator/max8952.c b/drivers/regulator/max8952.c
index b4084314c222..c0ab4ddc1023 100644
--- a/drivers/regulator/max8952.c
+++ b/drivers/regulator/max8952.c
@@ -173,6 +173,7 @@ static int __devinit max8952_pmic_probe(struct i2c_client *client,
173{ 173{
174 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); 174 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
175 struct max8952_platform_data *pdata = client->dev.platform_data; 175 struct max8952_platform_data *pdata = client->dev.platform_data;
176 struct regulator_config config = { };
176 struct max8952_data *max8952; 177 struct max8952_data *max8952;
177 178
178 int ret = 0, err = 0; 179 int ret = 0, err = 0;
@@ -193,8 +194,11 @@ static int __devinit max8952_pmic_probe(struct i2c_client *client,
193 max8952->dev = &client->dev; 194 max8952->dev = &client->dev;
194 max8952->pdata = pdata; 195 max8952->pdata = pdata;
195 196
196 max8952->rdev = regulator_register(&regulator, max8952->dev, 197 config.dev = max8952->dev;
197 &pdata->reg_data, max8952, NULL); 198 config.init_data = &pdata->reg_data;
199 config.driver_data = max8952;
200
201 max8952->rdev = regulator_register(&regulator, &config);
198 202
199 if (IS_ERR(max8952->rdev)) { 203 if (IS_ERR(max8952->rdev)) {
200 ret = PTR_ERR(max8952->rdev); 204 ret = PTR_ERR(max8952->rdev);
diff --git a/drivers/regulator/max8997.c b/drivers/regulator/max8997.c
index 6e7beee1c205..48fa966929eb 100644
--- a/drivers/regulator/max8997.c
+++ b/drivers/regulator/max8997.c
@@ -913,6 +913,7 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev)
913{ 913{
914 struct max8997_dev *iodev = dev_get_drvdata(pdev->dev.parent); 914 struct max8997_dev *iodev = dev_get_drvdata(pdev->dev.parent);
915 struct max8997_platform_data *pdata = dev_get_platdata(iodev->dev); 915 struct max8997_platform_data *pdata = dev_get_platdata(iodev->dev);
916 struct regulator_config config = { };
916 struct regulator_dev **rdev; 917 struct regulator_dev **rdev;
917 struct max8997_data *max8997; 918 struct max8997_data *max8997;
918 struct i2c_client *i2c; 919 struct i2c_client *i2c;
@@ -1096,8 +1097,11 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev)
1096 else if (id == MAX8997_CHARGER_CV) 1097 else if (id == MAX8997_CHARGER_CV)
1097 regulators[id].n_voltages = 16; 1098 regulators[id].n_voltages = 16;
1098 1099
1099 rdev[i] = regulator_register(&regulators[id], max8997->dev, 1100 config.dev = max8997->dev;
1100 pdata->regulators[i].initdata, max8997, NULL); 1101 config.init_data = pdata->regulators[i].initdata;
1102 config.driver_data = max8997;
1103
1104 rdev[i] = regulator_register(&regulators[id], &config);
1101 if (IS_ERR(rdev[i])) { 1105 if (IS_ERR(rdev[i])) {
1102 ret = PTR_ERR(rdev[i]); 1106 ret = PTR_ERR(rdev[i]);
1103 dev_err(max8997->dev, "regulator init failed for %d\n", 1107 dev_err(max8997->dev, "regulator init failed for %d\n",
diff --git a/drivers/regulator/max8998.c b/drivers/regulator/max8998.c
index 5890265eeacc..74b0b0c94120 100644
--- a/drivers/regulator/max8998.c
+++ b/drivers/regulator/max8998.c
@@ -685,6 +685,7 @@ static __devinit int max8998_pmic_probe(struct platform_device *pdev)
685{ 685{
686 struct max8998_dev *iodev = dev_get_drvdata(pdev->dev.parent); 686 struct max8998_dev *iodev = dev_get_drvdata(pdev->dev.parent);
687 struct max8998_platform_data *pdata = dev_get_platdata(iodev->dev); 687 struct max8998_platform_data *pdata = dev_get_platdata(iodev->dev);
688 struct regulator_config config = { };
688 struct regulator_dev **rdev; 689 struct regulator_dev **rdev;
689 struct max8998_data *max8998; 690 struct max8998_data *max8998;
690 struct i2c_client *i2c; 691 struct i2c_client *i2c;
@@ -840,8 +841,12 @@ static __devinit int max8998_pmic_probe(struct platform_device *pdev)
840 int count = (desc->max - desc->min) / desc->step + 1; 841 int count = (desc->max - desc->min) / desc->step + 1;
841 regulators[index].n_voltages = count; 842 regulators[index].n_voltages = count;
842 } 843 }
843 rdev[i] = regulator_register(&regulators[index], max8998->dev, 844
844 pdata->regulators[i].initdata, max8998, NULL); 845 config.dev = max8998->dev;
846 config.init_data = pdata->regulators[i].initdata;
847 config.driver_data = max8998;
848
849 rdev[i] = regulator_register(&regulators[index], &config);
845 if (IS_ERR(rdev[i])) { 850 if (IS_ERR(rdev[i])) {
846 ret = PTR_ERR(rdev[i]); 851 ret = PTR_ERR(rdev[i]);
847 dev_err(max8998->dev, "regulator init failed\n"); 852 dev_err(max8998->dev, "regulator init failed\n");
diff --git a/drivers/regulator/pcap-regulator.c b/drivers/regulator/pcap-regulator.c
index b55128db07cc..8211101121f0 100644
--- a/drivers/regulator/pcap-regulator.c
+++ b/drivers/regulator/pcap-regulator.c
@@ -251,9 +251,13 @@ static int __devinit pcap_regulator_probe(struct platform_device *pdev)
251{ 251{
252 struct regulator_dev *rdev; 252 struct regulator_dev *rdev;
253 void *pcap = dev_get_drvdata(pdev->dev.parent); 253 void *pcap = dev_get_drvdata(pdev->dev.parent);
254 struct regulator_config config = { };
254 255
255 rdev = regulator_register(&pcap_regulators[pdev->id], &pdev->dev, 256 config.dev = &pdev->dev;
256 pdev->dev.platform_data, pcap, NULL); 257 config.init_data = pdev->dev.platform_data;
258 config.driver_data = pcap;
259
260 rdev = regulator_register(&pcap_regulators[pdev->id], &config);
257 if (IS_ERR(rdev)) 261 if (IS_ERR(rdev))
258 return PTR_ERR(rdev); 262 return PTR_ERR(rdev);
259 263
diff --git a/drivers/regulator/pcf50633-regulator.c b/drivers/regulator/pcf50633-regulator.c
index 43163f14bec7..7ee70f1b3f24 100644
--- a/drivers/regulator/pcf50633-regulator.c
+++ b/drivers/regulator/pcf50633-regulator.c
@@ -296,12 +296,16 @@ static int __devinit pcf50633_regulator_probe(struct platform_device *pdev)
296{ 296{
297 struct regulator_dev *rdev; 297 struct regulator_dev *rdev;
298 struct pcf50633 *pcf; 298 struct pcf50633 *pcf;
299 struct regulator_config config = { };
299 300
300 /* Already set by core driver */ 301 /* Already set by core driver */
301 pcf = dev_to_pcf50633(pdev->dev.parent); 302 pcf = dev_to_pcf50633(pdev->dev.parent);
302 303
303 rdev = regulator_register(&regulators[pdev->id], &pdev->dev, 304 config.dev = &pdev->dev;
304 pdev->dev.platform_data, pcf, NULL); 305 config.init_data = pdev->dev.platform_data;
306 config.driver_data = pcf;
307
308 rdev = regulator_register(&regulators[pdev->id], &config);
305 if (IS_ERR(rdev)) 309 if (IS_ERR(rdev))
306 return PTR_ERR(rdev); 310 return PTR_ERR(rdev);
307 311
diff --git a/drivers/regulator/rc5t583-regulator.c b/drivers/regulator/rc5t583-regulator.c
index fe094a6140d9..b567c9ec47c1 100644
--- a/drivers/regulator/rc5t583-regulator.c
+++ b/drivers/regulator/rc5t583-regulator.c
@@ -251,6 +251,7 @@ static int __devinit rc5t583_regulator_probe(struct platform_device *pdev)
251 struct rc5t583 *rc5t583 = dev_get_drvdata(pdev->dev.parent); 251 struct rc5t583 *rc5t583 = dev_get_drvdata(pdev->dev.parent);
252 struct rc5t583_platform_data *pdata = dev_get_platdata(rc5t583->dev); 252 struct rc5t583_platform_data *pdata = dev_get_platdata(rc5t583->dev);
253 struct regulator_init_data *reg_data; 253 struct regulator_init_data *reg_data;
254 struct regulator_config config = { };
254 struct rc5t583_regulator *reg = NULL; 255 struct rc5t583_regulator *reg = NULL;
255 struct rc5t583_regulator *regs; 256 struct rc5t583_regulator *regs;
256 struct regulator_dev *rdev; 257 struct regulator_dev *rdev;
@@ -300,8 +301,11 @@ static int __devinit rc5t583_regulator_probe(struct platform_device *pdev)
300 "Failed to configure ext control %d\n", id); 301 "Failed to configure ext control %d\n", id);
301 302
302skip_ext_pwr_config: 303skip_ext_pwr_config:
303 rdev = regulator_register(&ri->desc, &pdev->dev, 304 config.dev = &pdev->dev;
304 reg_data, reg, NULL); 305 config.init_data = reg_data;
306 config.driver_data = reg;
307
308 rdev = regulator_register(&ri->desc, &config);
305 if (IS_ERR(rdev)) { 309 if (IS_ERR(rdev)) {
306 dev_err(&pdev->dev, "Failed to register regulator %s\n", 310 dev_err(&pdev->dev, "Failed to register regulator %s\n",
307 ri->desc.name); 311 ri->desc.name);
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",
diff --git a/drivers/regulator/tps6105x-regulator.c b/drivers/regulator/tps6105x-regulator.c
index 3b788977cb72..d840d8440a91 100644
--- a/drivers/regulator/tps6105x-regulator.c
+++ b/drivers/regulator/tps6105x-regulator.c
@@ -139,6 +139,7 @@ static int __devinit tps6105x_regulator_probe(struct platform_device *pdev)
139{ 139{
140 struct tps6105x *tps6105x = dev_get_platdata(&pdev->dev); 140 struct tps6105x *tps6105x = dev_get_platdata(&pdev->dev);
141 struct tps6105x_platform_data *pdata = tps6105x->pdata; 141 struct tps6105x_platform_data *pdata = tps6105x->pdata;
142 struct regulator_config config = { };
142 int ret; 143 int ret;
143 144
144 /* This instance is not set for regulator mode so bail out */ 145 /* This instance is not set for regulator mode so bail out */
@@ -148,11 +149,13 @@ static int __devinit tps6105x_regulator_probe(struct platform_device *pdev)
148 return 0; 149 return 0;
149 } 150 }
150 151
152 config.dev = &tps6105x->client->dev;
153 config.init_data = pdata->regulator_data;
154 config.driver_data = tps6105x;
155
151 /* Register regulator with framework */ 156 /* Register regulator with framework */
152 tps6105x->regulator = regulator_register(&tps6105x_regulator_desc, 157 tps6105x->regulator = regulator_register(&tps6105x_regulator_desc,
153 &tps6105x->client->dev, 158 &config);
154 pdata->regulator_data, tps6105x,
155 NULL);
156 if (IS_ERR(tps6105x->regulator)) { 159 if (IS_ERR(tps6105x->regulator)) {
157 ret = PTR_ERR(tps6105x->regulator); 160 ret = PTR_ERR(tps6105x->regulator);
158 dev_err(&tps6105x->client->dev, 161 dev_err(&tps6105x->client->dev,
diff --git a/drivers/regulator/tps62360-regulator.c b/drivers/regulator/tps62360-regulator.c
index aa57632c0150..8fffc6e45b3a 100644
--- a/drivers/regulator/tps62360-regulator.c
+++ b/drivers/regulator/tps62360-regulator.c
@@ -270,6 +270,7 @@ static const struct regmap_config tps62360_regmap_config = {
270static int __devinit tps62360_probe(struct i2c_client *client, 270static int __devinit tps62360_probe(struct i2c_client *client,
271 const struct i2c_device_id *id) 271 const struct i2c_device_id *id)
272{ 272{
273 struct regulator_config config = { };
273 struct tps62360_regulator_platform_data *pdata; 274 struct tps62360_regulator_platform_data *pdata;
274 struct regulator_dev *rdev; 275 struct regulator_dev *rdev;
275 struct tps62360_chip *tps; 276 struct tps62360_chip *tps;
@@ -384,9 +385,12 @@ static int __devinit tps62360_probe(struct i2c_client *client,
384 goto err_init; 385 goto err_init;
385 } 386 }
386 387
388 config.dev = &client->dev;
389 config.init_data = &pdata->reg_init_data;
390 config.driver_data = tps;
391
387 /* Register the regulators */ 392 /* Register the regulators */
388 rdev = regulator_register(&tps->desc, &client->dev, 393 rdev = regulator_register(&tps->desc, &config);
389 &pdata->reg_init_data, tps, NULL);
390 if (IS_ERR(rdev)) { 394 if (IS_ERR(rdev)) {
391 dev_err(tps->dev, "%s() Err: Failed to register %s\n", 395 dev_err(tps->dev, "%s() Err: Failed to register %s\n",
392 __func__, id->name); 396 __func__, id->name);
diff --git a/drivers/regulator/tps65023-regulator.c b/drivers/regulator/tps65023-regulator.c
index 5c9a9001f816..7755afeecede 100644
--- a/drivers/regulator/tps65023-regulator.c
+++ b/drivers/regulator/tps65023-regulator.c
@@ -376,6 +376,7 @@ static int __devinit tps_65023_probe(struct i2c_client *client,
376{ 376{
377 const struct tps_driver_data *drv_data = (void *)id->driver_data; 377 const struct tps_driver_data *drv_data = (void *)id->driver_data;
378 const struct tps_info *info = drv_data->info; 378 const struct tps_info *info = drv_data->info;
379 struct regulator_config config = { };
379 struct regulator_init_data *init_data; 380 struct regulator_init_data *init_data;
380 struct regulator_dev *rdev; 381 struct regulator_dev *rdev;
381 struct tps_pmic *tps; 382 struct tps_pmic *tps;
@@ -420,9 +421,12 @@ static int __devinit tps_65023_probe(struct i2c_client *client,
420 tps->desc[i].type = REGULATOR_VOLTAGE; 421 tps->desc[i].type = REGULATOR_VOLTAGE;
421 tps->desc[i].owner = THIS_MODULE; 422 tps->desc[i].owner = THIS_MODULE;
422 423
424 config.dev = &client->dev;
425 config.init_data = init_data;
426 config.driver_data = tps;
427
423 /* Register the regulators */ 428 /* Register the regulators */
424 rdev = regulator_register(&tps->desc[i], &client->dev, 429 rdev = regulator_register(&tps->desc[i], &config);
425 init_data, tps, NULL);
426 if (IS_ERR(rdev)) { 430 if (IS_ERR(rdev)) {
427 dev_err(&client->dev, "failed to register %s\n", 431 dev_err(&client->dev, "failed to register %s\n",
428 id->name); 432 id->name);
diff --git a/drivers/regulator/tps6507x-regulator.c b/drivers/regulator/tps6507x-regulator.c
index 832833fe8aad..16d27fc2c7f7 100644
--- a/drivers/regulator/tps6507x-regulator.c
+++ b/drivers/regulator/tps6507x-regulator.c
@@ -404,6 +404,7 @@ static __devinit int tps6507x_pmic_probe(struct platform_device *pdev)
404{ 404{
405 struct tps6507x_dev *tps6507x_dev = dev_get_drvdata(pdev->dev.parent); 405 struct tps6507x_dev *tps6507x_dev = dev_get_drvdata(pdev->dev.parent);
406 struct tps_info *info = &tps6507x_pmic_regs[0]; 406 struct tps_info *info = &tps6507x_pmic_regs[0];
407 struct regulator_config config = { };
407 struct regulator_init_data *init_data; 408 struct regulator_init_data *init_data;
408 struct regulator_dev *rdev; 409 struct regulator_dev *rdev;
409 struct tps6507x_pmic *tps; 410 struct tps6507x_pmic *tps;
@@ -453,8 +454,11 @@ static __devinit int tps6507x_pmic_probe(struct platform_device *pdev)
453 tps->desc[i].type = REGULATOR_VOLTAGE; 454 tps->desc[i].type = REGULATOR_VOLTAGE;
454 tps->desc[i].owner = THIS_MODULE; 455 tps->desc[i].owner = THIS_MODULE;
455 456
456 rdev = regulator_register(&tps->desc[i], 457 config.dev = tps6507x_dev->dev;
457 tps6507x_dev->dev, init_data, tps, NULL); 458 config.init_data = init_data;
459 config.driver_data = tps;
460
461 rdev = regulator_register(&tps->desc[i], &config);
458 if (IS_ERR(rdev)) { 462 if (IS_ERR(rdev)) {
459 dev_err(tps6507x_dev->dev, 463 dev_err(tps6507x_dev->dev,
460 "failed to register %s regulator\n", 464 "failed to register %s regulator\n",
diff --git a/drivers/regulator/tps65090-regulator.c b/drivers/regulator/tps65090-regulator.c
index 7baff2e8765d..6bbf760be80a 100644
--- a/drivers/regulator/tps65090-regulator.c
+++ b/drivers/regulator/tps65090-regulator.c
@@ -137,6 +137,7 @@ static inline struct tps65090_regulator *find_regulator_info(int id)
137static int __devinit tps65090_regulator_probe(struct platform_device *pdev) 137static int __devinit tps65090_regulator_probe(struct platform_device *pdev)
138{ 138{
139 struct tps65090_regulator *ri = NULL; 139 struct tps65090_regulator *ri = NULL;
140 struct regulator_config config = { };
140 struct regulator_dev *rdev; 141 struct regulator_dev *rdev;
141 struct tps65090_regulator_platform_data *tps_pdata; 142 struct tps65090_regulator_platform_data *tps_pdata;
142 int id = pdev->id; 143 int id = pdev->id;
@@ -151,8 +152,11 @@ static int __devinit tps65090_regulator_probe(struct platform_device *pdev)
151 tps_pdata = pdev->dev.platform_data; 152 tps_pdata = pdev->dev.platform_data;
152 ri->dev = &pdev->dev; 153 ri->dev = &pdev->dev;
153 154
154 rdev = regulator_register(&ri->desc, &pdev->dev, 155 config.dev = &pdev->dev;
155 &tps_pdata->regulator, ri, NULL); 156 config.init_data = &tps_pdata->regulator;
157 config.driver_data = ri;
158
159 rdev = regulator_register(&ri->desc, &config);
156 if (IS_ERR(rdev)) { 160 if (IS_ERR(rdev)) {
157 dev_err(&pdev->dev, "failed to register regulator %s\n", 161 dev_err(&pdev->dev, "failed to register regulator %s\n",
158 ri->desc.name); 162 ri->desc.name);
diff --git a/drivers/regulator/tps65217-regulator.c b/drivers/regulator/tps65217-regulator.c
index 80fad2d3479e..00c5c1c96d19 100644
--- a/drivers/regulator/tps65217-regulator.c
+++ b/drivers/regulator/tps65217-regulator.c
@@ -327,13 +327,17 @@ static int __devinit tps65217_regulator_probe(struct platform_device *pdev)
327 struct regulator_dev *rdev; 327 struct regulator_dev *rdev;
328 struct tps65217 *tps; 328 struct tps65217 *tps;
329 struct tps_info *info = &tps65217_pmic_regs[pdev->id]; 329 struct tps_info *info = &tps65217_pmic_regs[pdev->id];
330 struct regulator_config config = { };
330 331
331 /* Already set by core driver */ 332 /* Already set by core driver */
332 tps = dev_to_tps65217(pdev->dev.parent); 333 tps = dev_to_tps65217(pdev->dev.parent);
333 tps->info[pdev->id] = info; 334 tps->info[pdev->id] = info;
334 335
335 rdev = regulator_register(&regulators[pdev->id], &pdev->dev, 336 config.dev = &pdev->dev;
336 pdev->dev.platform_data, tps, NULL); 337 config.init_data = pdev->dev.platform_data;
338 config.driver_data = tps;
339
340 rdev = regulator_register(&regulators[pdev->id], &config);
337 if (IS_ERR(rdev)) 341 if (IS_ERR(rdev))
338 return PTR_ERR(rdev); 342 return PTR_ERR(rdev);
339 343
diff --git a/drivers/regulator/tps6524x-regulator.c b/drivers/regulator/tps6524x-regulator.c
index eabf0e601f65..6616af7d2956 100644
--- a/drivers/regulator/tps6524x-regulator.c
+++ b/drivers/regulator/tps6524x-regulator.c
@@ -605,6 +605,7 @@ static int __devinit pmic_probe(struct spi_device *spi)
605 struct device *dev = &spi->dev; 605 struct device *dev = &spi->dev;
606 const struct supply_info *info = supply_info; 606 const struct supply_info *info = supply_info;
607 struct regulator_init_data *init_data; 607 struct regulator_init_data *init_data;
608 struct regulator_config config = { };
608 int ret = 0, i; 609 int ret = 0, i;
609 610
610 init_data = dev->platform_data; 611 init_data = dev->platform_data;
@@ -636,8 +637,11 @@ static int __devinit pmic_probe(struct spi_device *spi)
636 if (info->flags & FIXED_VOLTAGE) 637 if (info->flags & FIXED_VOLTAGE)
637 hw->desc[i].n_voltages = 1; 638 hw->desc[i].n_voltages = 1;
638 639
639 hw->rdev[i] = regulator_register(&hw->desc[i], dev, 640 config.dev = dev;
640 init_data, hw, NULL); 641 config.init_data = init_data;
642 config.driver_data = hw;
643
644 hw->rdev[i] = regulator_register(&hw->desc[i], &config);
641 if (IS_ERR(hw->rdev[i])) { 645 if (IS_ERR(hw->rdev[i])) {
642 ret = PTR_ERR(hw->rdev[i]); 646 ret = PTR_ERR(hw->rdev[i]);
643 hw->rdev[i] = NULL; 647 hw->rdev[i] = NULL;
diff --git a/drivers/regulator/tps6586x-regulator.c b/drivers/regulator/tps6586x-regulator.c
index 2dd66fe9570f..deb855c41e16 100644
--- a/drivers/regulator/tps6586x-regulator.c
+++ b/drivers/regulator/tps6586x-regulator.c
@@ -340,6 +340,7 @@ static inline struct tps6586x_regulator *find_regulator_info(int id)
340static int __devinit tps6586x_regulator_probe(struct platform_device *pdev) 340static int __devinit tps6586x_regulator_probe(struct platform_device *pdev)
341{ 341{
342 struct tps6586x_regulator *ri = NULL; 342 struct tps6586x_regulator *ri = NULL;
343 struct regulator_config config = { };
343 struct regulator_dev *rdev; 344 struct regulator_dev *rdev;
344 int id = pdev->id; 345 int id = pdev->id;
345 int err; 346 int err;
@@ -356,8 +357,11 @@ static int __devinit tps6586x_regulator_probe(struct platform_device *pdev)
356 if (err) 357 if (err)
357 return err; 358 return err;
358 359
359 rdev = regulator_register(&ri->desc, &pdev->dev, 360 config.dev = &pdev->dev;
360 pdev->dev.platform_data, ri, NULL); 361 config.init_data = pdev->dev.platform_data;
362 config.driver_data = ri;
363
364 rdev = regulator_register(&ri->desc, &config);
361 if (IS_ERR(rdev)) { 365 if (IS_ERR(rdev)) {
362 dev_err(&pdev->dev, "failed to register regulator %s\n", 366 dev_err(&pdev->dev, "failed to register regulator %s\n",
363 ri->desc.name); 367 ri->desc.name);
diff --git a/drivers/regulator/tps65910-regulator.c b/drivers/regulator/tps65910-regulator.c
index 4a37c2b6367f..e7a4ece10628 100644
--- a/drivers/regulator/tps65910-regulator.c
+++ b/drivers/regulator/tps65910-regulator.c
@@ -1097,6 +1097,7 @@ static int tps65910_set_ext_sleep_config(struct tps65910_reg *pmic,
1097static __devinit int tps65910_probe(struct platform_device *pdev) 1097static __devinit int tps65910_probe(struct platform_device *pdev)
1098{ 1098{
1099 struct tps65910 *tps65910 = dev_get_drvdata(pdev->dev.parent); 1099 struct tps65910 *tps65910 = dev_get_drvdata(pdev->dev.parent);
1100 struct regulator_config config = { };
1100 struct tps_info *info; 1101 struct tps_info *info;
1101 struct regulator_init_data *reg_data; 1102 struct regulator_init_data *reg_data;
1102 struct regulator_dev *rdev; 1103 struct regulator_dev *rdev;
@@ -1206,8 +1207,11 @@ static __devinit int tps65910_probe(struct platform_device *pdev)
1206 pmic->desc[i].type = REGULATOR_VOLTAGE; 1207 pmic->desc[i].type = REGULATOR_VOLTAGE;
1207 pmic->desc[i].owner = THIS_MODULE; 1208 pmic->desc[i].owner = THIS_MODULE;
1208 1209
1209 rdev = regulator_register(&pmic->desc[i], 1210 config.dev = tps65910->dev;
1210 tps65910->dev, reg_data, pmic, NULL); 1211 config.init_data = reg_data;
1212 config.driver_data = pmic;
1213
1214 rdev = regulator_register(&pmic->desc[i], &config);
1211 if (IS_ERR(rdev)) { 1215 if (IS_ERR(rdev)) {
1212 dev_err(tps65910->dev, 1216 dev_err(tps65910->dev,
1213 "failed to register %s regulator\n", 1217 "failed to register %s regulator\n",
diff --git a/drivers/regulator/tps65912-regulator.c b/drivers/regulator/tps65912-regulator.c
index 05ea096cf8a7..8c9c61383fee 100644
--- a/drivers/regulator/tps65912-regulator.c
+++ b/drivers/regulator/tps65912-regulator.c
@@ -463,6 +463,7 @@ static struct regulator_ops tps65912_ops_ldo = {
463static __devinit int tps65912_probe(struct platform_device *pdev) 463static __devinit int tps65912_probe(struct platform_device *pdev)
464{ 464{
465 struct tps65912 *tps65912 = dev_get_drvdata(pdev->dev.parent); 465 struct tps65912 *tps65912 = dev_get_drvdata(pdev->dev.parent);
466 struct regulator_config config = { };
466 struct tps_info *info; 467 struct tps_info *info;
467 struct regulator_init_data *reg_data; 468 struct regulator_init_data *reg_data;
468 struct regulator_dev *rdev; 469 struct regulator_dev *rdev;
@@ -500,8 +501,12 @@ static __devinit int tps65912_probe(struct platform_device *pdev)
500 pmic->desc[i].type = REGULATOR_VOLTAGE; 501 pmic->desc[i].type = REGULATOR_VOLTAGE;
501 pmic->desc[i].owner = THIS_MODULE; 502 pmic->desc[i].owner = THIS_MODULE;
502 range = tps65912_get_range(pmic, i); 503 range = tps65912_get_range(pmic, i);
503 rdev = regulator_register(&pmic->desc[i], 504
504 tps65912->dev, reg_data, pmic, NULL); 505 config.dev = tps65912->dev;
506 config.init_data = reg_data;
507 config.driver_data = pmic;
508
509 rdev = regulator_register(&pmic->desc[i], &config);
505 if (IS_ERR(rdev)) { 510 if (IS_ERR(rdev)) {
506 dev_err(tps65912->dev, 511 dev_err(tps65912->dev,
507 "failed to register %s regulator\n", 512 "failed to register %s regulator\n",
diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c
index 107a08bc50d9..9cf6f59d27bc 100644
--- a/drivers/regulator/twl-regulator.c
+++ b/drivers/regulator/twl-regulator.c
@@ -1175,6 +1175,7 @@ static int __devinit twlreg_probe(struct platform_device *pdev)
1175 struct regulator_dev *rdev; 1175 struct regulator_dev *rdev;
1176 struct twl_regulator_driver_data *drvdata; 1176 struct twl_regulator_driver_data *drvdata;
1177 const struct of_device_id *match; 1177 const struct of_device_id *match;
1178 struct regulator_config config = { };
1178 1179
1179 match = of_match_device(twl_of_match, &pdev->dev); 1180 match = of_match_device(twl_of_match, &pdev->dev);
1180 if (match) { 1181 if (match) {
@@ -1254,8 +1255,12 @@ static int __devinit twlreg_probe(struct platform_device *pdev)
1254 break; 1255 break;
1255 } 1256 }
1256 1257
1257 rdev = regulator_register(&info->desc, &pdev->dev, initdata, info, 1258 config.dev = &pdev->dev;
1258 pdev->dev.of_node); 1259 config.init_data = initdata;
1260 config.driver_data = info;
1261 config.of_node = pdev->dev.of_node;
1262
1263 rdev = regulator_register(&info->desc, &config);
1259 if (IS_ERR(rdev)) { 1264 if (IS_ERR(rdev)) {
1260 dev_err(&pdev->dev, "can't register %s, %ld\n", 1265 dev_err(&pdev->dev, "can't register %s, %ld\n",
1261 info->desc.name, PTR_ERR(rdev)); 1266 info->desc.name, PTR_ERR(rdev));
diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c
index 909c53b70375..c754eae18c4a 100644
--- a/drivers/regulator/wm831x-dcdc.c
+++ b/drivers/regulator/wm831x-dcdc.c
@@ -495,6 +495,7 @@ static __devinit int wm831x_buckv_probe(struct platform_device *pdev)
495{ 495{
496 struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); 496 struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent);
497 struct wm831x_pdata *pdata = wm831x->dev->platform_data; 497 struct wm831x_pdata *pdata = wm831x->dev->platform_data;
498 struct regulator_config config = { };
498 int id; 499 int id;
499 struct wm831x_dcdc *dcdc; 500 struct wm831x_dcdc *dcdc;
500 struct resource *res; 501 struct resource *res;
@@ -553,8 +554,11 @@ static __devinit int wm831x_buckv_probe(struct platform_device *pdev)
553 if (pdata->dcdc[id]) 554 if (pdata->dcdc[id])
554 wm831x_buckv_dvs_init(dcdc, pdata->dcdc[id]->driver_data); 555 wm831x_buckv_dvs_init(dcdc, pdata->dcdc[id]->driver_data);
555 556
556 dcdc->regulator = regulator_register(&dcdc->desc, &pdev->dev, 557 config.dev = pdev->dev.parent;
557 pdata->dcdc[id], dcdc, NULL); 558 config.init_data = pdata->dcdc[id];
559 config.driver_data = dcdc;
560
561 dcdc->regulator = regulator_register(&dcdc->desc, &config);
558 if (IS_ERR(dcdc->regulator)) { 562 if (IS_ERR(dcdc->regulator)) {
559 ret = PTR_ERR(dcdc->regulator); 563 ret = PTR_ERR(dcdc->regulator);
560 dev_err(wm831x->dev, "Failed to register DCDC%d: %d\n", 564 dev_err(wm831x->dev, "Failed to register DCDC%d: %d\n",
@@ -705,6 +709,7 @@ static __devinit int wm831x_buckp_probe(struct platform_device *pdev)
705{ 709{
706 struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); 710 struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent);
707 struct wm831x_pdata *pdata = wm831x->dev->platform_data; 711 struct wm831x_pdata *pdata = wm831x->dev->platform_data;
712 struct regulator_config config = { };
708 int id; 713 int id;
709 struct wm831x_dcdc *dcdc; 714 struct wm831x_dcdc *dcdc;
710 struct resource *res; 715 struct resource *res;
@@ -746,8 +751,11 @@ static __devinit int wm831x_buckp_probe(struct platform_device *pdev)
746 dcdc->desc.ops = &wm831x_buckp_ops; 751 dcdc->desc.ops = &wm831x_buckp_ops;
747 dcdc->desc.owner = THIS_MODULE; 752 dcdc->desc.owner = THIS_MODULE;
748 753
749 dcdc->regulator = regulator_register(&dcdc->desc, &pdev->dev, 754 config.dev = pdev->dev.parent;
750 pdata->dcdc[id], dcdc, NULL); 755 config.init_data = pdata->dcdc[id];
756 config.driver_data = dcdc;
757
758 dcdc->regulator = regulator_register(&dcdc->desc, &config);
751 if (IS_ERR(dcdc->regulator)) { 759 if (IS_ERR(dcdc->regulator)) {
752 ret = PTR_ERR(dcdc->regulator); 760 ret = PTR_ERR(dcdc->regulator);
753 dev_err(wm831x->dev, "Failed to register DCDC%d: %d\n", 761 dev_err(wm831x->dev, "Failed to register DCDC%d: %d\n",
@@ -838,6 +846,7 @@ static __devinit int wm831x_boostp_probe(struct platform_device *pdev)
838{ 846{
839 struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); 847 struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent);
840 struct wm831x_pdata *pdata = wm831x->dev->platform_data; 848 struct wm831x_pdata *pdata = wm831x->dev->platform_data;
849 struct regulator_config config = { };
841 int id = pdev->id % ARRAY_SIZE(pdata->dcdc); 850 int id = pdev->id % ARRAY_SIZE(pdata->dcdc);
842 struct wm831x_dcdc *dcdc; 851 struct wm831x_dcdc *dcdc;
843 struct resource *res; 852 struct resource *res;
@@ -871,8 +880,11 @@ static __devinit int wm831x_boostp_probe(struct platform_device *pdev)
871 dcdc->desc.ops = &wm831x_boostp_ops; 880 dcdc->desc.ops = &wm831x_boostp_ops;
872 dcdc->desc.owner = THIS_MODULE; 881 dcdc->desc.owner = THIS_MODULE;
873 882
874 dcdc->regulator = regulator_register(&dcdc->desc, &pdev->dev, 883 config.dev = pdev->dev.parent;
875 pdata->dcdc[id], dcdc, NULL); 884 config.init_data = pdata->dcdc[id];
885 config.driver_data = dcdc;
886
887 dcdc->regulator = regulator_register(&dcdc->desc, &config);
876 if (IS_ERR(dcdc->regulator)) { 888 if (IS_ERR(dcdc->regulator)) {
877 ret = PTR_ERR(dcdc->regulator); 889 ret = PTR_ERR(dcdc->regulator);
878 dev_err(wm831x->dev, "Failed to register DCDC%d: %d\n", 890 dev_err(wm831x->dev, "Failed to register DCDC%d: %d\n",
@@ -941,6 +953,7 @@ static __devinit int wm831x_epe_probe(struct platform_device *pdev)
941{ 953{
942 struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); 954 struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent);
943 struct wm831x_pdata *pdata = wm831x->dev->platform_data; 955 struct wm831x_pdata *pdata = wm831x->dev->platform_data;
956 struct regulator_config config = { };
944 int id = pdev->id % ARRAY_SIZE(pdata->epe); 957 int id = pdev->id % ARRAY_SIZE(pdata->epe);
945 struct wm831x_dcdc *dcdc; 958 struct wm831x_dcdc *dcdc;
946 int ret; 959 int ret;
@@ -968,8 +981,11 @@ static __devinit int wm831x_epe_probe(struct platform_device *pdev)
968 dcdc->desc.type = REGULATOR_VOLTAGE; 981 dcdc->desc.type = REGULATOR_VOLTAGE;
969 dcdc->desc.owner = THIS_MODULE; 982 dcdc->desc.owner = THIS_MODULE;
970 983
971 dcdc->regulator = regulator_register(&dcdc->desc, &pdev->dev, 984 config.dev = pdev->dev.parent;
972 pdata->epe[id], dcdc, NULL); 985 config.init_data = pdata->epe[id];
986 config.driver_data = dcdc;
987
988 dcdc->regulator = regulator_register(&dcdc->desc, &config);
973 if (IS_ERR(dcdc->regulator)) { 989 if (IS_ERR(dcdc->regulator)) {
974 ret = PTR_ERR(dcdc->regulator); 990 ret = PTR_ERR(dcdc->regulator);
975 dev_err(wm831x->dev, "Failed to register EPE%d: %d\n", 991 dev_err(wm831x->dev, "Failed to register EPE%d: %d\n",
diff --git a/drivers/regulator/wm831x-isink.c b/drivers/regulator/wm831x-isink.c
index 634aac3f2d5f..046fabf648d2 100644
--- a/drivers/regulator/wm831x-isink.c
+++ b/drivers/regulator/wm831x-isink.c
@@ -154,6 +154,7 @@ static __devinit int wm831x_isink_probe(struct platform_device *pdev)
154 struct wm831x_pdata *pdata = wm831x->dev->platform_data; 154 struct wm831x_pdata *pdata = wm831x->dev->platform_data;
155 struct wm831x_isink *isink; 155 struct wm831x_isink *isink;
156 int id = pdev->id % ARRAY_SIZE(pdata->isink); 156 int id = pdev->id % ARRAY_SIZE(pdata->isink);
157 struct regulator_config config = { };
157 struct resource *res; 158 struct resource *res;
158 int ret, irq; 159 int ret, irq;
159 160
@@ -189,8 +190,11 @@ static __devinit int wm831x_isink_probe(struct platform_device *pdev)
189 isink->desc.type = REGULATOR_CURRENT; 190 isink->desc.type = REGULATOR_CURRENT;
190 isink->desc.owner = THIS_MODULE; 191 isink->desc.owner = THIS_MODULE;
191 192
192 isink->regulator = regulator_register(&isink->desc, &pdev->dev, 193 config.dev = pdev->dev.parent;
193 pdata->isink[id], isink, NULL); 194 config.init_data = pdata->isink[id];
195 config.driver_data = isink;
196
197 isink->regulator = regulator_register(&isink->desc, &config);
194 if (IS_ERR(isink->regulator)) { 198 if (IS_ERR(isink->regulator)) {
195 ret = PTR_ERR(isink->regulator); 199 ret = PTR_ERR(isink->regulator);
196 dev_err(wm831x->dev, "Failed to register ISINK%d: %d\n", 200 dev_err(wm831x->dev, "Failed to register ISINK%d: %d\n",
diff --git a/drivers/regulator/wm831x-ldo.c b/drivers/regulator/wm831x-ldo.c
index a4b16831f4ca..eb6a3061884c 100644
--- a/drivers/regulator/wm831x-ldo.c
+++ b/drivers/regulator/wm831x-ldo.c
@@ -310,6 +310,7 @@ static __devinit int wm831x_gp_ldo_probe(struct platform_device *pdev)
310{ 310{
311 struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); 311 struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent);
312 struct wm831x_pdata *pdata = wm831x->dev->platform_data; 312 struct wm831x_pdata *pdata = wm831x->dev->platform_data;
313 struct regulator_config config = { };
313 int id; 314 int id;
314 struct wm831x_ldo *ldo; 315 struct wm831x_ldo *ldo;
315 struct resource *res; 316 struct resource *res;
@@ -350,8 +351,11 @@ static __devinit int wm831x_gp_ldo_probe(struct platform_device *pdev)
350 ldo->desc.ops = &wm831x_gp_ldo_ops; 351 ldo->desc.ops = &wm831x_gp_ldo_ops;
351 ldo->desc.owner = THIS_MODULE; 352 ldo->desc.owner = THIS_MODULE;
352 353
353 ldo->regulator = regulator_register(&ldo->desc, &pdev->dev, 354 config.dev = pdev->dev.parent;
354 pdata->ldo[id], ldo, NULL); 355 config.init_data = pdata->ldo[id];
356 config.driver_data = ldo;
357
358 ldo->regulator = regulator_register(&ldo->desc, &config);
355 if (IS_ERR(ldo->regulator)) { 359 if (IS_ERR(ldo->regulator)) {
356 ret = PTR_ERR(ldo->regulator); 360 ret = PTR_ERR(ldo->regulator);
357 dev_err(wm831x->dev, "Failed to register LDO%d: %d\n", 361 dev_err(wm831x->dev, "Failed to register LDO%d: %d\n",
@@ -578,6 +582,7 @@ static __devinit int wm831x_aldo_probe(struct platform_device *pdev)
578{ 582{
579 struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); 583 struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent);
580 struct wm831x_pdata *pdata = wm831x->dev->platform_data; 584 struct wm831x_pdata *pdata = wm831x->dev->platform_data;
585 struct regulator_config config = { };
581 int id; 586 int id;
582 struct wm831x_ldo *ldo; 587 struct wm831x_ldo *ldo;
583 struct resource *res; 588 struct resource *res;
@@ -618,8 +623,11 @@ static __devinit int wm831x_aldo_probe(struct platform_device *pdev)
618 ldo->desc.ops = &wm831x_aldo_ops; 623 ldo->desc.ops = &wm831x_aldo_ops;
619 ldo->desc.owner = THIS_MODULE; 624 ldo->desc.owner = THIS_MODULE;
620 625
621 ldo->regulator = regulator_register(&ldo->desc, &pdev->dev, 626 config.dev = pdev->dev.parent;
622 pdata->ldo[id], ldo, NULL); 627 config.init_data = pdata->ldo[id];
628 config.driver_data = ldo;
629
630 ldo->regulator = regulator_register(&ldo->desc, &config);
623 if (IS_ERR(ldo->regulator)) { 631 if (IS_ERR(ldo->regulator)) {
624 ret = PTR_ERR(ldo->regulator); 632 ret = PTR_ERR(ldo->regulator);
625 dev_err(wm831x->dev, "Failed to register LDO%d: %d\n", 633 dev_err(wm831x->dev, "Failed to register LDO%d: %d\n",
@@ -772,6 +780,7 @@ static __devinit int wm831x_alive_ldo_probe(struct platform_device *pdev)
772{ 780{
773 struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); 781 struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent);
774 struct wm831x_pdata *pdata = wm831x->dev->platform_data; 782 struct wm831x_pdata *pdata = wm831x->dev->platform_data;
783 struct regulator_config config = { };
775 int id; 784 int id;
776 struct wm831x_ldo *ldo; 785 struct wm831x_ldo *ldo;
777 struct resource *res; 786 struct resource *res;
@@ -813,8 +822,11 @@ static __devinit int wm831x_alive_ldo_probe(struct platform_device *pdev)
813 ldo->desc.ops = &wm831x_alive_ldo_ops; 822 ldo->desc.ops = &wm831x_alive_ldo_ops;
814 ldo->desc.owner = THIS_MODULE; 823 ldo->desc.owner = THIS_MODULE;
815 824
816 ldo->regulator = regulator_register(&ldo->desc, &pdev->dev, 825 config.dev = pdev->dev.parent;
817 pdata->ldo[id], ldo, NULL); 826 config.init_data = pdata->ldo[id];
827 config.driver_data = ldo;
828
829 ldo->regulator = regulator_register(&ldo->desc, &config);
818 if (IS_ERR(ldo->regulator)) { 830 if (IS_ERR(ldo->regulator)) {
819 ret = PTR_ERR(ldo->regulator); 831 ret = PTR_ERR(ldo->regulator);
820 dev_err(wm831x->dev, "Failed to register LDO%d: %d\n", 832 dev_err(wm831x->dev, "Failed to register LDO%d: %d\n",
diff --git a/drivers/regulator/wm8350-regulator.c b/drivers/regulator/wm8350-regulator.c
index 552b1edf8091..4dcbab1314a5 100644
--- a/drivers/regulator/wm8350-regulator.c
+++ b/drivers/regulator/wm8350-regulator.c
@@ -1398,6 +1398,7 @@ static irqreturn_t pmic_uv_handler(int irq, void *data)
1398static int wm8350_regulator_probe(struct platform_device *pdev) 1398static int wm8350_regulator_probe(struct platform_device *pdev)
1399{ 1399{
1400 struct wm8350 *wm8350 = dev_get_drvdata(&pdev->dev); 1400 struct wm8350 *wm8350 = dev_get_drvdata(&pdev->dev);
1401 struct regulator_config config = { };
1401 struct regulator_dev *rdev; 1402 struct regulator_dev *rdev;
1402 int ret; 1403 int ret;
1403 u16 val; 1404 u16 val;
@@ -1425,10 +1426,12 @@ static int wm8350_regulator_probe(struct platform_device *pdev)
1425 break; 1426 break;
1426 } 1427 }
1427 1428
1429 config.dev = &pdev->dev;
1430 config.init_data = pdev->dev.platform_data;
1431 config.driver_data = dev_get_drvdata(&pdev->dev);
1432
1428 /* register regulator */ 1433 /* register regulator */
1429 rdev = regulator_register(&wm8350_reg[pdev->id], &pdev->dev, 1434 rdev = regulator_register(&wm8350_reg[pdev->id], &config);
1430 pdev->dev.platform_data,
1431 dev_get_drvdata(&pdev->dev), NULL);
1432 if (IS_ERR(rdev)) { 1435 if (IS_ERR(rdev)) {
1433 dev_err(&pdev->dev, "failed to register %s\n", 1436 dev_err(&pdev->dev, "failed to register %s\n",
1434 wm8350_reg[pdev->id].name); 1437 wm8350_reg[pdev->id].name);
diff --git a/drivers/regulator/wm8400-regulator.c b/drivers/regulator/wm8400-regulator.c
index 8477153780b6..4408b7802e75 100644
--- a/drivers/regulator/wm8400-regulator.c
+++ b/drivers/regulator/wm8400-regulator.c
@@ -323,11 +323,14 @@ static struct regulator_desc regulators[] = {
323static int __devinit wm8400_regulator_probe(struct platform_device *pdev) 323static int __devinit wm8400_regulator_probe(struct platform_device *pdev)
324{ 324{
325 struct wm8400 *wm8400 = container_of(pdev, struct wm8400, regulators[pdev->id]); 325 struct wm8400 *wm8400 = container_of(pdev, struct wm8400, regulators[pdev->id]);
326 struct regulator_config config = { };
326 struct regulator_dev *rdev; 327 struct regulator_dev *rdev;
327 328
328 rdev = regulator_register(&regulators[pdev->id], &pdev->dev, 329 config.dev = &pdev->dev;
329 pdev->dev.platform_data, wm8400, NULL); 330 config.init_data = pdev->dev.platform_data;
331 config.driver_data = wm8400;
330 332
333 rdev = regulator_register(&regulators[pdev->id], &config);
331 if (IS_ERR(rdev)) 334 if (IS_ERR(rdev))
332 return PTR_ERR(rdev); 335 return PTR_ERR(rdev);
333 336
diff --git a/drivers/regulator/wm8994-regulator.c b/drivers/regulator/wm8994-regulator.c
index 8a4897a35f28..f4a62941b711 100644
--- a/drivers/regulator/wm8994-regulator.c
+++ b/drivers/regulator/wm8994-regulator.c
@@ -233,6 +233,7 @@ static __devinit int wm8994_ldo_probe(struct platform_device *pdev)
233 struct wm8994 *wm8994 = dev_get_drvdata(pdev->dev.parent); 233 struct wm8994 *wm8994 = dev_get_drvdata(pdev->dev.parent);
234 struct wm8994_pdata *pdata = wm8994->dev->platform_data; 234 struct wm8994_pdata *pdata = wm8994->dev->platform_data;
235 int id = pdev->id % ARRAY_SIZE(pdata->ldo); 235 int id = pdev->id % ARRAY_SIZE(pdata->ldo);
236 struct regulator_config config = { };
236 struct wm8994_ldo *ldo; 237 struct wm8994_ldo *ldo;
237 int ret; 238 int ret;
238 239
@@ -268,8 +269,11 @@ static __devinit int wm8994_ldo_probe(struct platform_device *pdev)
268 } else 269 } else
269 ldo->is_enabled = true; 270 ldo->is_enabled = true;
270 271
271 ldo->regulator = regulator_register(&wm8994_ldo_desc[id], &pdev->dev, 272 config.dev = &pdev->dev;
272 pdata->ldo[id].init_data, ldo, NULL); 273 config.init_data = pdata->ldo[id].init_data;
274 config.driver_data = ldo;
275
276 ldo->regulator = regulator_register(&wm8994_ldo_desc[id], &config);
273 if (IS_ERR(ldo->regulator)) { 277 if (IS_ERR(ldo->regulator)) {
274 ret = PTR_ERR(ldo->regulator); 278 ret = PTR_ERR(ldo->regulator);
275 dev_err(wm8994->dev, "Failed to register LDO%d: %d\n", 279 dev_err(wm8994->dev, "Failed to register LDO%d: %d\n",
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 1dcdf00e0db2..4f529ed48d4c 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -148,10 +148,12 @@ enum regulator_type {
148}; 148};
149 149
150/** 150/**
151 * struct regulator_desc - Regulator descriptor 151 * struct regulator_desc - Static regulator descriptor
152 * 152 *
153 * Each regulator registered with the core is described with a structure of 153 * Each regulator registered with the core is described with a
154 * this type. 154 * structure of this type and a struct regulator_config. This
155 * structure contains the non-varying parts of the regulator
156 * description.
155 * 157 *
156 * @name: Identifying name for the regulator. 158 * @name: Identifying name for the regulator.
157 * @supply_name: Identifying the regulator supply 159 * @supply_name: Identifying the regulator supply
@@ -173,6 +175,26 @@ struct regulator_desc {
173 struct module *owner; 175 struct module *owner;
174}; 176};
175 177
178/**
179 * struct regulator_config - Dynamic regulator descriptor
180 *
181 * Each regulator registered with the core is described with a
182 * structure of this type and a struct regulator_desc. This structure
183 * contains the runtime variable parts of the regulator description.
184 *
185 * @dev: struct device for the regulator
186 * @init_data: platform provided init data, passed through by driver
187 * @driver_data: private regulator data
188 * @of_node: OpenFirmware node to parse for device tree bindings (may be
189 * NULL).
190 */
191struct regulator_config {
192 struct device *dev;
193 const struct regulator_init_data *init_data;
194 void *driver_data;
195 struct device_node *of_node;
196};
197
176/* 198/*
177 * struct regulator_dev 199 * struct regulator_dev
178 * 200 *
@@ -212,8 +234,7 @@ struct regulator_dev {
212 234
213struct regulator_dev * 235struct regulator_dev *
214regulator_register(const struct regulator_desc *regulator_desc, 236regulator_register(const struct regulator_desc *regulator_desc,
215 struct device *dev, const struct regulator_init_data *init_data, 237 const struct regulator_config *config);
216 void *driver_data, struct device_node *of_node);
217void regulator_unregister(struct regulator_dev *rdev); 238void regulator_unregister(struct regulator_dev *rdev);
218 239
219int regulator_notifier_call_chain(struct regulator_dev *rdev, 240int regulator_notifier_call_chain(struct regulator_dev *rdev,
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index d1926266fe00..a554b0c8ad38 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -808,6 +808,7 @@ static int ldo_regulator_register(struct snd_soc_codec *codec,
808{ 808{
809 struct ldo_regulator *ldo; 809 struct ldo_regulator *ldo;
810 struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec); 810 struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec);
811 struct regulator_config config = { };
811 812
812 ldo = kzalloc(sizeof(struct ldo_regulator), GFP_KERNEL); 813 ldo = kzalloc(sizeof(struct ldo_regulator), GFP_KERNEL);
813 814
@@ -831,8 +832,11 @@ static int ldo_regulator_register(struct snd_soc_codec *codec,
831 ldo->codec_data = codec; 832 ldo->codec_data = codec;
832 ldo->voltage = voltage; 833 ldo->voltage = voltage;
833 834
834 ldo->dev = regulator_register(&ldo->desc, codec->dev, 835 config.dev = codec->dev;
835 init_data, ldo, NULL); 836 config.driver_data = ldo;
837 config.init_data = init_data;
838
839 ldo->dev = regulator_register(&ldo->desc, &config);
836 if (IS_ERR(ldo->dev)) { 840 if (IS_ERR(ldo->dev)) {
837 int ret = PTR_ERR(ldo->dev); 841 int ret = PTR_ERR(ldo->dev);
838 842