diff options
author | Mark Brown <broonie@linaro.org> | 2013-10-24 06:11:35 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-10-24 06:11:35 -0400 |
commit | b735e47f6e94f07911dcdf92837ebfd0ec1cf7c0 (patch) | |
tree | 12b9d1bf32084db43b7c1060c59410c194786dfb | |
parent | 3242a86170070a332037bff65ab5872189e20791 (diff) | |
parent | 5e0855759ca621bba454747fc1b5b76a7290f50f (diff) |
Merge remote-tracking branch 'regulator/topic/devm' into regulator-next
-rw-r--r-- | drivers/regulator/ab3100.c | 3 | ||||
-rw-r--r-- | drivers/regulator/ab8500-ext.c | 26 | ||||
-rw-r--r-- | drivers/regulator/da9063-regulator.c | 21 | ||||
-rw-r--r-- | drivers/regulator/da9210-regulator.c | 10 | ||||
-rw-r--r-- | drivers/regulator/lp872x.c | 33 | ||||
-rw-r--r-- | drivers/regulator/lp8788-buck.c | 12 | ||||
-rw-r--r-- | drivers/regulator/lp8788-ldo.c | 24 | ||||
-rw-r--r-- | drivers/regulator/max8925-regulator.c | 12 | ||||
-rw-r--r-- | drivers/regulator/pcap-regulator.c | 13 | ||||
-rw-r--r-- | drivers/regulator/pcf50633-regulator.c | 13 | ||||
-rw-r--r-- | drivers/regulator/tps6105x-regulator.c | 13 | ||||
-rw-r--r-- | drivers/regulator/tps6524x-regulator.c | 32 | ||||
-rw-r--r-- | drivers/regulator/twl-regulator.c | 3 | ||||
-rw-r--r-- | drivers/regulator/vexpress.c | 3 |
14 files changed, 29 insertions, 189 deletions
diff --git a/drivers/regulator/ab3100.c b/drivers/regulator/ab3100.c index 7d5eaa874b2d..77b46d0b37a6 100644 --- a/drivers/regulator/ab3100.c +++ b/drivers/regulator/ab3100.c | |||
@@ -535,7 +535,7 @@ static int ab3100_regulator_register(struct platform_device *pdev, | |||
535 | config.dev = &pdev->dev; | 535 | config.dev = &pdev->dev; |
536 | config.driver_data = reg; | 536 | config.driver_data = reg; |
537 | 537 | ||
538 | rdev = regulator_register(desc, &config); | 538 | rdev = devm_regulator_register(&pdev->dev, desc, &config); |
539 | if (IS_ERR(rdev)) { | 539 | if (IS_ERR(rdev)) { |
540 | err = PTR_ERR(rdev); | 540 | err = PTR_ERR(rdev); |
541 | dev_err(&pdev->dev, | 541 | dev_err(&pdev->dev, |
@@ -616,7 +616,6 @@ static int ab3100_regulators_remove(struct platform_device *pdev) | |||
616 | for (i = 0; i < AB3100_NUM_REGULATORS; i++) { | 616 | for (i = 0; i < AB3100_NUM_REGULATORS; i++) { |
617 | struct ab3100_regulator *reg = &ab3100_regulators[i]; | 617 | struct ab3100_regulator *reg = &ab3100_regulators[i]; |
618 | 618 | ||
619 | regulator_unregister(reg->rdev); | ||
620 | reg->rdev = NULL; | 619 | reg->rdev = NULL; |
621 | } | 620 | } |
622 | return 0; | 621 | return 0; |
diff --git a/drivers/regulator/ab8500-ext.c b/drivers/regulator/ab8500-ext.c index 02ff691cdb8b..29c0faaf8eba 100644 --- a/drivers/regulator/ab8500-ext.c +++ b/drivers/regulator/ab8500-ext.c | |||
@@ -413,16 +413,12 @@ static int ab8500_ext_regulator_probe(struct platform_device *pdev) | |||
413 | &pdata->ext_regulator[i]; | 413 | &pdata->ext_regulator[i]; |
414 | 414 | ||
415 | /* register regulator with framework */ | 415 | /* register regulator with framework */ |
416 | info->rdev = regulator_register(&info->desc, &config); | 416 | info->rdev = devm_regulator_register(&pdev->dev, &info->desc, |
417 | &config); | ||
417 | if (IS_ERR(info->rdev)) { | 418 | if (IS_ERR(info->rdev)) { |
418 | err = PTR_ERR(info->rdev); | 419 | err = PTR_ERR(info->rdev); |
419 | dev_err(&pdev->dev, "failed to register regulator %s\n", | 420 | dev_err(&pdev->dev, "failed to register regulator %s\n", |
420 | info->desc.name); | 421 | info->desc.name); |
421 | /* when we fail, un-register all earlier regulators */ | ||
422 | while (--i >= 0) { | ||
423 | info = &ab8500_ext_regulator_info[i]; | ||
424 | regulator_unregister(info->rdev); | ||
425 | } | ||
426 | return err; | 422 | return err; |
427 | } | 423 | } |
428 | 424 | ||
@@ -433,26 +429,8 @@ static int ab8500_ext_regulator_probe(struct platform_device *pdev) | |||
433 | return 0; | 429 | return 0; |
434 | } | 430 | } |
435 | 431 | ||
436 | static int ab8500_ext_regulator_remove(struct platform_device *pdev) | ||
437 | { | ||
438 | int i; | ||
439 | |||
440 | for (i = 0; i < ARRAY_SIZE(ab8500_ext_regulator_info); i++) { | ||
441 | struct ab8500_ext_regulator_info *info = NULL; | ||
442 | info = &ab8500_ext_regulator_info[i]; | ||
443 | |||
444 | dev_vdbg(rdev_get_dev(info->rdev), | ||
445 | "%s-remove\n", info->desc.name); | ||
446 | |||
447 | regulator_unregister(info->rdev); | ||
448 | } | ||
449 | |||
450 | return 0; | ||
451 | } | ||
452 | |||
453 | static struct platform_driver ab8500_ext_regulator_driver = { | 432 | static struct platform_driver ab8500_ext_regulator_driver = { |
454 | .probe = ab8500_ext_regulator_probe, | 433 | .probe = ab8500_ext_regulator_probe, |
455 | .remove = ab8500_ext_regulator_remove, | ||
456 | .driver = { | 434 | .driver = { |
457 | .name = "ab8500-ext-regulator", | 435 | .name = "ab8500-ext-regulator", |
458 | .owner = THIS_MODULE, | 436 | .owner = THIS_MODULE, |
diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da9063-regulator.c index 3d910f4f3a0e..56727eb745df 100644 --- a/drivers/regulator/da9063-regulator.c +++ b/drivers/regulator/da9063-regulator.c | |||
@@ -847,13 +847,13 @@ static int da9063_regulator_probe(struct platform_device *pdev) | |||
847 | if (da9063_reg_matches) | 847 | if (da9063_reg_matches) |
848 | config.of_node = da9063_reg_matches[id].of_node; | 848 | config.of_node = da9063_reg_matches[id].of_node; |
849 | config.regmap = da9063->regmap; | 849 | config.regmap = da9063->regmap; |
850 | regl->rdev = regulator_register(®l->desc, &config); | 850 | regl->rdev = devm_regulator_register(&pdev->dev, ®l->desc, |
851 | &config); | ||
851 | if (IS_ERR(regl->rdev)) { | 852 | if (IS_ERR(regl->rdev)) { |
852 | dev_err(&pdev->dev, | 853 | dev_err(&pdev->dev, |
853 | "Failed to register %s regulator\n", | 854 | "Failed to register %s regulator\n", |
854 | regl->desc.name); | 855 | regl->desc.name); |
855 | ret = PTR_ERR(regl->rdev); | 856 | return PTR_ERR(regl->rdev); |
856 | goto err; | ||
857 | } | 857 | } |
858 | id++; | 858 | id++; |
859 | n++; | 859 | n++; |
@@ -862,9 +862,8 @@ static int da9063_regulator_probe(struct platform_device *pdev) | |||
862 | /* LDOs overcurrent event support */ | 862 | /* LDOs overcurrent event support */ |
863 | irq = platform_get_irq_byname(pdev, "LDO_LIM"); | 863 | irq = platform_get_irq_byname(pdev, "LDO_LIM"); |
864 | if (irq < 0) { | 864 | if (irq < 0) { |
865 | ret = irq; | ||
866 | dev_err(&pdev->dev, "Failed to get IRQ.\n"); | 865 | dev_err(&pdev->dev, "Failed to get IRQ.\n"); |
867 | goto err; | 866 | return irq; |
868 | } | 867 | } |
869 | 868 | ||
870 | regulators->irq_ldo_lim = regmap_irq_get_virq(da9063->regmap_irq, irq); | 869 | regulators->irq_ldo_lim = regmap_irq_get_virq(da9063->regmap_irq, irq); |
@@ -881,27 +880,15 @@ static int da9063_regulator_probe(struct platform_device *pdev) | |||
881 | } | 880 | } |
882 | 881 | ||
883 | return 0; | 882 | return 0; |
884 | |||
885 | err: | ||
886 | /* Wind back regulators registeration */ | ||
887 | while (--n >= 0) | ||
888 | regulator_unregister(regulators->regulator[n].rdev); | ||
889 | |||
890 | return ret; | ||
891 | } | 883 | } |
892 | 884 | ||
893 | static int da9063_regulator_remove(struct platform_device *pdev) | 885 | static int da9063_regulator_remove(struct platform_device *pdev) |
894 | { | 886 | { |
895 | struct da9063_regulators *regulators = platform_get_drvdata(pdev); | 887 | struct da9063_regulators *regulators = platform_get_drvdata(pdev); |
896 | struct da9063_regulator *regl; | ||
897 | 888 | ||
898 | free_irq(regulators->irq_ldo_lim, regulators); | 889 | free_irq(regulators->irq_ldo_lim, regulators); |
899 | free_irq(regulators->irq_uvov, regulators); | 890 | free_irq(regulators->irq_uvov, regulators); |
900 | 891 | ||
901 | for (regl = ®ulators->regulator[regulators->n_regulators - 1]; | ||
902 | regl >= ®ulators->regulator[0]; regl--) | ||
903 | regulator_unregister(regl->rdev); | ||
904 | |||
905 | return 0; | 892 | return 0; |
906 | } | 893 | } |
907 | 894 | ||
diff --git a/drivers/regulator/da9210-regulator.c b/drivers/regulator/da9210-regulator.c index f7ccff14f763..6f5ecbe1132e 100644 --- a/drivers/regulator/da9210-regulator.c +++ b/drivers/regulator/da9210-regulator.c | |||
@@ -155,7 +155,7 @@ static int da9210_i2c_probe(struct i2c_client *i2c, | |||
155 | config.regmap = chip->regmap; | 155 | config.regmap = chip->regmap; |
156 | config.of_node = dev->of_node; | 156 | config.of_node = dev->of_node; |
157 | 157 | ||
158 | rdev = regulator_register(&da9210_reg, &config); | 158 | rdev = devm_regulator_register(&i2c->dev, &da9210_reg, &config); |
159 | if (IS_ERR(rdev)) { | 159 | if (IS_ERR(rdev)) { |
160 | dev_err(&i2c->dev, "Failed to register DA9210 regulator\n"); | 160 | dev_err(&i2c->dev, "Failed to register DA9210 regulator\n"); |
161 | return PTR_ERR(rdev); | 161 | return PTR_ERR(rdev); |
@@ -168,13 +168,6 @@ static int da9210_i2c_probe(struct i2c_client *i2c, | |||
168 | return 0; | 168 | return 0; |
169 | } | 169 | } |
170 | 170 | ||
171 | static int da9210_i2c_remove(struct i2c_client *i2c) | ||
172 | { | ||
173 | struct da9210 *chip = i2c_get_clientdata(i2c); | ||
174 | regulator_unregister(chip->rdev); | ||
175 | return 0; | ||
176 | } | ||
177 | |||
178 | static const struct i2c_device_id da9210_i2c_id[] = { | 171 | static const struct i2c_device_id da9210_i2c_id[] = { |
179 | {"da9210", 0}, | 172 | {"da9210", 0}, |
180 | {}, | 173 | {}, |
@@ -188,7 +181,6 @@ static struct i2c_driver da9210_regulator_driver = { | |||
188 | .owner = THIS_MODULE, | 181 | .owner = THIS_MODULE, |
189 | }, | 182 | }, |
190 | .probe = da9210_i2c_probe, | 183 | .probe = da9210_i2c_probe, |
191 | .remove = da9210_i2c_remove, | ||
192 | .id_table = da9210_i2c_id, | 184 | .id_table = da9210_i2c_id, |
193 | }; | 185 | }; |
194 | 186 | ||
diff --git a/drivers/regulator/lp872x.c b/drivers/regulator/lp872x.c index 2b84b727a3c4..2e4734ff79fc 100644 --- a/drivers/regulator/lp872x.c +++ b/drivers/regulator/lp872x.c | |||
@@ -785,7 +785,7 @@ static int lp872x_regulator_register(struct lp872x *lp) | |||
785 | struct regulator_desc *desc; | 785 | struct regulator_desc *desc; |
786 | struct regulator_config cfg = { }; | 786 | struct regulator_config cfg = { }; |
787 | struct regulator_dev *rdev; | 787 | struct regulator_dev *rdev; |
788 | int i, ret; | 788 | int i; |
789 | 789 | ||
790 | for (i = 0; i < lp->num_regulators; i++) { | 790 | for (i = 0; i < lp->num_regulators; i++) { |
791 | desc = (lp->chipid == LP8720) ? &lp8720_regulator_desc[i] : | 791 | desc = (lp->chipid == LP8720) ? &lp8720_regulator_desc[i] : |
@@ -796,34 +796,16 @@ static int lp872x_regulator_register(struct lp872x *lp) | |||
796 | cfg.driver_data = lp; | 796 | cfg.driver_data = lp; |
797 | cfg.regmap = lp->regmap; | 797 | cfg.regmap = lp->regmap; |
798 | 798 | ||
799 | rdev = regulator_register(desc, &cfg); | 799 | rdev = devm_regulator_register(lp->dev, desc, &cfg); |
800 | if (IS_ERR(rdev)) { | 800 | if (IS_ERR(rdev)) { |
801 | dev_err(lp->dev, "regulator register err"); | 801 | dev_err(lp->dev, "regulator register err"); |
802 | ret = PTR_ERR(rdev); | 802 | return PTR_ERR(rdev); |
803 | goto err; | ||
804 | } | 803 | } |
805 | 804 | ||
806 | *(lp->regulators + i) = rdev; | 805 | *(lp->regulators + i) = rdev; |
807 | } | 806 | } |
808 | 807 | ||
809 | return 0; | 808 | return 0; |
810 | err: | ||
811 | while (--i >= 0) { | ||
812 | rdev = *(lp->regulators + i); | ||
813 | regulator_unregister(rdev); | ||
814 | } | ||
815 | return ret; | ||
816 | } | ||
817 | |||
818 | static void lp872x_regulator_unregister(struct lp872x *lp) | ||
819 | { | ||
820 | struct regulator_dev *rdev; | ||
821 | int i; | ||
822 | |||
823 | for (i = 0; i < lp->num_regulators; i++) { | ||
824 | rdev = *(lp->regulators + i); | ||
825 | regulator_unregister(rdev); | ||
826 | } | ||
827 | } | 809 | } |
828 | 810 | ||
829 | static const struct regmap_config lp872x_regmap_config = { | 811 | static const struct regmap_config lp872x_regmap_config = { |
@@ -979,14 +961,6 @@ err_dev: | |||
979 | return ret; | 961 | return ret; |
980 | } | 962 | } |
981 | 963 | ||
982 | static int lp872x_remove(struct i2c_client *cl) | ||
983 | { | ||
984 | struct lp872x *lp = i2c_get_clientdata(cl); | ||
985 | |||
986 | lp872x_regulator_unregister(lp); | ||
987 | return 0; | ||
988 | } | ||
989 | |||
990 | static const struct of_device_id lp872x_dt_ids[] = { | 964 | static const struct of_device_id lp872x_dt_ids[] = { |
991 | { .compatible = "ti,lp8720", }, | 965 | { .compatible = "ti,lp8720", }, |
992 | { .compatible = "ti,lp8725", }, | 966 | { .compatible = "ti,lp8725", }, |
@@ -1008,7 +982,6 @@ static struct i2c_driver lp872x_driver = { | |||
1008 | .of_match_table = of_match_ptr(lp872x_dt_ids), | 982 | .of_match_table = of_match_ptr(lp872x_dt_ids), |
1009 | }, | 983 | }, |
1010 | .probe = lp872x_probe, | 984 | .probe = lp872x_probe, |
1011 | .remove = lp872x_remove, | ||
1012 | .id_table = lp872x_ids, | 985 | .id_table = lp872x_ids, |
1013 | }; | 986 | }; |
1014 | 987 | ||
diff --git a/drivers/regulator/lp8788-buck.c b/drivers/regulator/lp8788-buck.c index 0b015f2a7fd9..948afc249e29 100644 --- a/drivers/regulator/lp8788-buck.c +++ b/drivers/regulator/lp8788-buck.c | |||
@@ -515,7 +515,7 @@ static int lp8788_buck_probe(struct platform_device *pdev) | |||
515 | cfg.driver_data = buck; | 515 | cfg.driver_data = buck; |
516 | cfg.regmap = lp->regmap; | 516 | cfg.regmap = lp->regmap; |
517 | 517 | ||
518 | rdev = regulator_register(&lp8788_buck_desc[id], &cfg); | 518 | rdev = devm_regulator_register(&pdev->dev, &lp8788_buck_desc[id], &cfg); |
519 | if (IS_ERR(rdev)) { | 519 | if (IS_ERR(rdev)) { |
520 | ret = PTR_ERR(rdev); | 520 | ret = PTR_ERR(rdev); |
521 | dev_err(&pdev->dev, "BUCK%d regulator register err = %d\n", | 521 | dev_err(&pdev->dev, "BUCK%d regulator register err = %d\n", |
@@ -529,18 +529,8 @@ static int lp8788_buck_probe(struct platform_device *pdev) | |||
529 | return 0; | 529 | return 0; |
530 | } | 530 | } |
531 | 531 | ||
532 | static int lp8788_buck_remove(struct platform_device *pdev) | ||
533 | { | ||
534 | struct lp8788_buck *buck = platform_get_drvdata(pdev); | ||
535 | |||
536 | regulator_unregister(buck->regulator); | ||
537 | |||
538 | return 0; | ||
539 | } | ||
540 | |||
541 | static struct platform_driver lp8788_buck_driver = { | 532 | static struct platform_driver lp8788_buck_driver = { |
542 | .probe = lp8788_buck_probe, | 533 | .probe = lp8788_buck_probe, |
543 | .remove = lp8788_buck_remove, | ||
544 | .driver = { | 534 | .driver = { |
545 | .name = LP8788_DEV_BUCK, | 535 | .name = LP8788_DEV_BUCK, |
546 | .owner = THIS_MODULE, | 536 | .owner = THIS_MODULE, |
diff --git a/drivers/regulator/lp8788-ldo.c b/drivers/regulator/lp8788-ldo.c index 0527d87c6dd5..b9a29a29933f 100644 --- a/drivers/regulator/lp8788-ldo.c +++ b/drivers/regulator/lp8788-ldo.c | |||
@@ -543,7 +543,7 @@ static int lp8788_dldo_probe(struct platform_device *pdev) | |||
543 | cfg.driver_data = ldo; | 543 | cfg.driver_data = ldo; |
544 | cfg.regmap = lp->regmap; | 544 | cfg.regmap = lp->regmap; |
545 | 545 | ||
546 | rdev = regulator_register(&lp8788_dldo_desc[id], &cfg); | 546 | rdev = devm_regulator_register(&pdev->dev, &lp8788_dldo_desc[id], &cfg); |
547 | if (IS_ERR(rdev)) { | 547 | if (IS_ERR(rdev)) { |
548 | ret = PTR_ERR(rdev); | 548 | ret = PTR_ERR(rdev); |
549 | dev_err(&pdev->dev, "DLDO%d regulator register err = %d\n", | 549 | dev_err(&pdev->dev, "DLDO%d regulator register err = %d\n", |
@@ -557,18 +557,8 @@ static int lp8788_dldo_probe(struct platform_device *pdev) | |||
557 | return 0; | 557 | return 0; |
558 | } | 558 | } |
559 | 559 | ||
560 | static int lp8788_dldo_remove(struct platform_device *pdev) | ||
561 | { | ||
562 | struct lp8788_ldo *ldo = platform_get_drvdata(pdev); | ||
563 | |||
564 | regulator_unregister(ldo->regulator); | ||
565 | |||
566 | return 0; | ||
567 | } | ||
568 | |||
569 | static struct platform_driver lp8788_dldo_driver = { | 560 | static struct platform_driver lp8788_dldo_driver = { |
570 | .probe = lp8788_dldo_probe, | 561 | .probe = lp8788_dldo_probe, |
571 | .remove = lp8788_dldo_remove, | ||
572 | .driver = { | 562 | .driver = { |
573 | .name = LP8788_DEV_DLDO, | 563 | .name = LP8788_DEV_DLDO, |
574 | .owner = THIS_MODULE, | 564 | .owner = THIS_MODULE, |
@@ -603,7 +593,7 @@ static int lp8788_aldo_probe(struct platform_device *pdev) | |||
603 | cfg.driver_data = ldo; | 593 | cfg.driver_data = ldo; |
604 | cfg.regmap = lp->regmap; | 594 | cfg.regmap = lp->regmap; |
605 | 595 | ||
606 | rdev = regulator_register(&lp8788_aldo_desc[id], &cfg); | 596 | rdev = devm_regulator_register(&pdev->dev, &lp8788_aldo_desc[id], &cfg); |
607 | if (IS_ERR(rdev)) { | 597 | if (IS_ERR(rdev)) { |
608 | ret = PTR_ERR(rdev); | 598 | ret = PTR_ERR(rdev); |
609 | dev_err(&pdev->dev, "ALDO%d regulator register err = %d\n", | 599 | dev_err(&pdev->dev, "ALDO%d regulator register err = %d\n", |
@@ -617,18 +607,8 @@ static int lp8788_aldo_probe(struct platform_device *pdev) | |||
617 | return 0; | 607 | return 0; |
618 | } | 608 | } |
619 | 609 | ||
620 | static int lp8788_aldo_remove(struct platform_device *pdev) | ||
621 | { | ||
622 | struct lp8788_ldo *ldo = platform_get_drvdata(pdev); | ||
623 | |||
624 | regulator_unregister(ldo->regulator); | ||
625 | |||
626 | return 0; | ||
627 | } | ||
628 | |||
629 | static struct platform_driver lp8788_aldo_driver = { | 610 | static struct platform_driver lp8788_aldo_driver = { |
630 | .probe = lp8788_aldo_probe, | 611 | .probe = lp8788_aldo_probe, |
631 | .remove = lp8788_aldo_remove, | ||
632 | .driver = { | 612 | .driver = { |
633 | .name = LP8788_DEV_ALDO, | 613 | .name = LP8788_DEV_ALDO, |
634 | .owner = THIS_MODULE, | 614 | .owner = THIS_MODULE, |
diff --git a/drivers/regulator/max8925-regulator.c b/drivers/regulator/max8925-regulator.c index d80b5fa758ae..759510789e71 100644 --- a/drivers/regulator/max8925-regulator.c +++ b/drivers/regulator/max8925-regulator.c | |||
@@ -312,7 +312,7 @@ static int max8925_regulator_probe(struct platform_device *pdev) | |||
312 | if (pdata) | 312 | if (pdata) |
313 | config.init_data = pdata; | 313 | config.init_data = pdata; |
314 | 314 | ||
315 | rdev = regulator_register(&ri->desc, &config); | 315 | rdev = devm_regulator_register(&pdev->dev, &ri->desc, &config); |
316 | if (IS_ERR(rdev)) { | 316 | if (IS_ERR(rdev)) { |
317 | dev_err(&pdev->dev, "failed to register regulator %s\n", | 317 | dev_err(&pdev->dev, "failed to register regulator %s\n", |
318 | ri->desc.name); | 318 | ri->desc.name); |
@@ -323,22 +323,12 @@ static int max8925_regulator_probe(struct platform_device *pdev) | |||
323 | return 0; | 323 | return 0; |
324 | } | 324 | } |
325 | 325 | ||
326 | static int max8925_regulator_remove(struct platform_device *pdev) | ||
327 | { | ||
328 | struct regulator_dev *rdev = platform_get_drvdata(pdev); | ||
329 | |||
330 | regulator_unregister(rdev); | ||
331 | |||
332 | return 0; | ||
333 | } | ||
334 | |||
335 | static struct platform_driver max8925_regulator_driver = { | 326 | static struct platform_driver max8925_regulator_driver = { |
336 | .driver = { | 327 | .driver = { |
337 | .name = "max8925-regulator", | 328 | .name = "max8925-regulator", |
338 | .owner = THIS_MODULE, | 329 | .owner = THIS_MODULE, |
339 | }, | 330 | }, |
340 | .probe = max8925_regulator_probe, | 331 | .probe = max8925_regulator_probe, |
341 | .remove = max8925_regulator_remove, | ||
342 | }; | 332 | }; |
343 | 333 | ||
344 | static int __init max8925_regulator_init(void) | 334 | static int __init max8925_regulator_init(void) |
diff --git a/drivers/regulator/pcap-regulator.c b/drivers/regulator/pcap-regulator.c index b49eaeedea84..3727b7d0e9ac 100644 --- a/drivers/regulator/pcap-regulator.c +++ b/drivers/regulator/pcap-regulator.c | |||
@@ -246,7 +246,8 @@ static int pcap_regulator_probe(struct platform_device *pdev) | |||
246 | config.init_data = dev_get_platdata(&pdev->dev); | 246 | config.init_data = dev_get_platdata(&pdev->dev); |
247 | config.driver_data = pcap; | 247 | config.driver_data = pcap; |
248 | 248 | ||
249 | rdev = regulator_register(&pcap_regulators[pdev->id], &config); | 249 | rdev = devm_regulator_register(&pdev->dev, &pcap_regulators[pdev->id], |
250 | &config); | ||
250 | if (IS_ERR(rdev)) | 251 | if (IS_ERR(rdev)) |
251 | return PTR_ERR(rdev); | 252 | return PTR_ERR(rdev); |
252 | 253 | ||
@@ -255,22 +256,12 @@ static int pcap_regulator_probe(struct platform_device *pdev) | |||
255 | return 0; | 256 | return 0; |
256 | } | 257 | } |
257 | 258 | ||
258 | static int pcap_regulator_remove(struct platform_device *pdev) | ||
259 | { | ||
260 | struct regulator_dev *rdev = platform_get_drvdata(pdev); | ||
261 | |||
262 | regulator_unregister(rdev); | ||
263 | |||
264 | return 0; | ||
265 | } | ||
266 | |||
267 | static struct platform_driver pcap_regulator_driver = { | 259 | static struct platform_driver pcap_regulator_driver = { |
268 | .driver = { | 260 | .driver = { |
269 | .name = "pcap-regulator", | 261 | .name = "pcap-regulator", |
270 | .owner = THIS_MODULE, | 262 | .owner = THIS_MODULE, |
271 | }, | 263 | }, |
272 | .probe = pcap_regulator_probe, | 264 | .probe = pcap_regulator_probe, |
273 | .remove = pcap_regulator_remove, | ||
274 | }; | 265 | }; |
275 | 266 | ||
276 | static int __init pcap_regulator_init(void) | 267 | static int __init pcap_regulator_init(void) |
diff --git a/drivers/regulator/pcf50633-regulator.c b/drivers/regulator/pcf50633-regulator.c index 0f3576d48abf..d7da1c15a6da 100644 --- a/drivers/regulator/pcf50633-regulator.c +++ b/drivers/regulator/pcf50633-regulator.c | |||
@@ -90,7 +90,8 @@ static int pcf50633_regulator_probe(struct platform_device *pdev) | |||
90 | config.driver_data = pcf; | 90 | config.driver_data = pcf; |
91 | config.regmap = pcf->regmap; | 91 | config.regmap = pcf->regmap; |
92 | 92 | ||
93 | rdev = regulator_register(®ulators[pdev->id], &config); | 93 | rdev = devm_regulator_register(&pdev->dev, ®ulators[pdev->id], |
94 | &config); | ||
94 | if (IS_ERR(rdev)) | 95 | if (IS_ERR(rdev)) |
95 | return PTR_ERR(rdev); | 96 | return PTR_ERR(rdev); |
96 | 97 | ||
@@ -102,21 +103,11 @@ static int pcf50633_regulator_probe(struct platform_device *pdev) | |||
102 | return 0; | 103 | return 0; |
103 | } | 104 | } |
104 | 105 | ||
105 | static int pcf50633_regulator_remove(struct platform_device *pdev) | ||
106 | { | ||
107 | struct regulator_dev *rdev = platform_get_drvdata(pdev); | ||
108 | |||
109 | regulator_unregister(rdev); | ||
110 | |||
111 | return 0; | ||
112 | } | ||
113 | |||
114 | static struct platform_driver pcf50633_regulator_driver = { | 106 | static struct platform_driver pcf50633_regulator_driver = { |
115 | .driver = { | 107 | .driver = { |
116 | .name = "pcf50633-regltr", | 108 | .name = "pcf50633-regltr", |
117 | }, | 109 | }, |
118 | .probe = pcf50633_regulator_probe, | 110 | .probe = pcf50633_regulator_probe, |
119 | .remove = pcf50633_regulator_remove, | ||
120 | }; | 111 | }; |
121 | 112 | ||
122 | static int __init pcf50633_regulator_init(void) | 113 | static int __init pcf50633_regulator_init(void) |
diff --git a/drivers/regulator/tps6105x-regulator.c b/drivers/regulator/tps6105x-regulator.c index ec9453ffb77f..e0e818d89f46 100644 --- a/drivers/regulator/tps6105x-regulator.c +++ b/drivers/regulator/tps6105x-regulator.c | |||
@@ -146,8 +146,9 @@ static int tps6105x_regulator_probe(struct platform_device *pdev) | |||
146 | config.driver_data = tps6105x; | 146 | config.driver_data = tps6105x; |
147 | 147 | ||
148 | /* Register regulator with framework */ | 148 | /* Register regulator with framework */ |
149 | tps6105x->regulator = regulator_register(&tps6105x_regulator_desc, | 149 | tps6105x->regulator = devm_regulator_register(&pdev->dev, |
150 | &config); | 150 | &tps6105x_regulator_desc, |
151 | &config); | ||
151 | if (IS_ERR(tps6105x->regulator)) { | 152 | if (IS_ERR(tps6105x->regulator)) { |
152 | ret = PTR_ERR(tps6105x->regulator); | 153 | ret = PTR_ERR(tps6105x->regulator); |
153 | dev_err(&tps6105x->client->dev, | 154 | dev_err(&tps6105x->client->dev, |
@@ -159,20 +160,12 @@ static int tps6105x_regulator_probe(struct platform_device *pdev) | |||
159 | return 0; | 160 | return 0; |
160 | } | 161 | } |
161 | 162 | ||
162 | static int tps6105x_regulator_remove(struct platform_device *pdev) | ||
163 | { | ||
164 | struct tps6105x *tps6105x = dev_get_platdata(&pdev->dev); | ||
165 | regulator_unregister(tps6105x->regulator); | ||
166 | return 0; | ||
167 | } | ||
168 | |||
169 | static struct platform_driver tps6105x_regulator_driver = { | 163 | static struct platform_driver tps6105x_regulator_driver = { |
170 | .driver = { | 164 | .driver = { |
171 | .name = "tps6105x-regulator", | 165 | .name = "tps6105x-regulator", |
172 | .owner = THIS_MODULE, | 166 | .owner = THIS_MODULE, |
173 | }, | 167 | }, |
174 | .probe = tps6105x_regulator_probe, | 168 | .probe = tps6105x_regulator_probe, |
175 | .remove = tps6105x_regulator_remove, | ||
176 | }; | 169 | }; |
177 | 170 | ||
178 | static __init int tps6105x_regulator_init(void) | 171 | static __init int tps6105x_regulator_init(void) |
diff --git a/drivers/regulator/tps6524x-regulator.c b/drivers/regulator/tps6524x-regulator.c index 62e8d28beabd..9f6bfda711b7 100644 --- a/drivers/regulator/tps6524x-regulator.c +++ b/drivers/regulator/tps6524x-regulator.c | |||
@@ -577,21 +577,6 @@ static struct regulator_ops regulator_ops = { | |||
577 | .get_current_limit = get_current_limit, | 577 | .get_current_limit = get_current_limit, |
578 | }; | 578 | }; |
579 | 579 | ||
580 | static int pmic_remove(struct spi_device *spi) | ||
581 | { | ||
582 | struct tps6524x *hw = spi_get_drvdata(spi); | ||
583 | int i; | ||
584 | |||
585 | if (!hw) | ||
586 | return 0; | ||
587 | for (i = 0; i < N_REGULATORS; i++) { | ||
588 | regulator_unregister(hw->rdev[i]); | ||
589 | hw->rdev[i] = NULL; | ||
590 | } | ||
591 | spi_set_drvdata(spi, NULL); | ||
592 | return 0; | ||
593 | } | ||
594 | |||
595 | static int pmic_probe(struct spi_device *spi) | 580 | static int pmic_probe(struct spi_device *spi) |
596 | { | 581 | { |
597 | struct tps6524x *hw; | 582 | struct tps6524x *hw; |
@@ -599,7 +584,7 @@ static int pmic_probe(struct spi_device *spi) | |||
599 | const struct supply_info *info = supply_info; | 584 | const struct supply_info *info = supply_info; |
600 | struct regulator_init_data *init_data; | 585 | struct regulator_init_data *init_data; |
601 | struct regulator_config config = { }; | 586 | struct regulator_config config = { }; |
602 | int ret = 0, i; | 587 | int i; |
603 | 588 | ||
604 | init_data = dev_get_platdata(dev); | 589 | init_data = dev_get_platdata(dev); |
605 | if (!init_data) { | 590 | if (!init_data) { |
@@ -632,24 +617,17 @@ static int pmic_probe(struct spi_device *spi) | |||
632 | config.init_data = init_data; | 617 | config.init_data = init_data; |
633 | config.driver_data = hw; | 618 | config.driver_data = hw; |
634 | 619 | ||
635 | hw->rdev[i] = regulator_register(&hw->desc[i], &config); | 620 | hw->rdev[i] = devm_regulator_register(dev, &hw->desc[i], |
636 | if (IS_ERR(hw->rdev[i])) { | 621 | &config); |
637 | ret = PTR_ERR(hw->rdev[i]); | 622 | if (IS_ERR(hw->rdev[i])) |
638 | hw->rdev[i] = NULL; | 623 | return PTR_ERR(hw->rdev[i]); |
639 | goto fail; | ||
640 | } | ||
641 | } | 624 | } |
642 | 625 | ||
643 | return 0; | 626 | return 0; |
644 | |||
645 | fail: | ||
646 | pmic_remove(spi); | ||
647 | return ret; | ||
648 | } | 627 | } |
649 | 628 | ||
650 | static struct spi_driver pmic_driver = { | 629 | static struct spi_driver pmic_driver = { |
651 | .probe = pmic_probe, | 630 | .probe = pmic_probe, |
652 | .remove = pmic_remove, | ||
653 | .driver = { | 631 | .driver = { |
654 | .name = "tps6524x", | 632 | .name = "tps6524x", |
655 | .owner = THIS_MODULE, | 633 | .owner = THIS_MODULE, |
diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c index 78aae4cbb004..8ebd785485c7 100644 --- a/drivers/regulator/twl-regulator.c +++ b/drivers/regulator/twl-regulator.c | |||
@@ -1188,7 +1188,7 @@ static int twlreg_probe(struct platform_device *pdev) | |||
1188 | config.driver_data = info; | 1188 | config.driver_data = info; |
1189 | config.of_node = pdev->dev.of_node; | 1189 | config.of_node = pdev->dev.of_node; |
1190 | 1190 | ||
1191 | rdev = regulator_register(&info->desc, &config); | 1191 | rdev = devm_regulator_register(&pdev->dev, &info->desc, &config); |
1192 | if (IS_ERR(rdev)) { | 1192 | if (IS_ERR(rdev)) { |
1193 | dev_err(&pdev->dev, "can't register %s, %ld\n", | 1193 | dev_err(&pdev->dev, "can't register %s, %ld\n", |
1194 | info->desc.name, PTR_ERR(rdev)); | 1194 | info->desc.name, PTR_ERR(rdev)); |
@@ -1217,7 +1217,6 @@ static int twlreg_remove(struct platform_device *pdev) | |||
1217 | struct regulator_dev *rdev = platform_get_drvdata(pdev); | 1217 | struct regulator_dev *rdev = platform_get_drvdata(pdev); |
1218 | struct twlreg_info *info = rdev->reg_data; | 1218 | struct twlreg_info *info = rdev->reg_data; |
1219 | 1219 | ||
1220 | regulator_unregister(rdev); | ||
1221 | kfree(info); | 1220 | kfree(info); |
1222 | return 0; | 1221 | return 0; |
1223 | } | 1222 | } |
diff --git a/drivers/regulator/vexpress.c b/drivers/regulator/vexpress.c index 4668c7f8133d..f3ae28a7e663 100644 --- a/drivers/regulator/vexpress.c +++ b/drivers/regulator/vexpress.c | |||
@@ -96,7 +96,7 @@ static int vexpress_regulator_probe(struct platform_device *pdev) | |||
96 | config.driver_data = reg; | 96 | config.driver_data = reg; |
97 | config.of_node = pdev->dev.of_node; | 97 | config.of_node = pdev->dev.of_node; |
98 | 98 | ||
99 | reg->regdev = regulator_register(®->desc, &config); | 99 | reg->regdev = devm_regulator_register(&pdev->dev, ®->desc, &config); |
100 | if (IS_ERR(reg->regdev)) { | 100 | if (IS_ERR(reg->regdev)) { |
101 | err = PTR_ERR(reg->regdev); | 101 | err = PTR_ERR(reg->regdev); |
102 | goto error_regulator_register; | 102 | goto error_regulator_register; |
@@ -119,7 +119,6 @@ static int vexpress_regulator_remove(struct platform_device *pdev) | |||
119 | struct vexpress_regulator *reg = platform_get_drvdata(pdev); | 119 | struct vexpress_regulator *reg = platform_get_drvdata(pdev); |
120 | 120 | ||
121 | vexpress_config_func_put(reg->func); | 121 | vexpress_config_func_put(reg->func); |
122 | regulator_unregister(reg->regdev); | ||
123 | 122 | ||
124 | return 0; | 123 | return 0; |
125 | } | 124 | } |