diff options
-rw-r--r-- | drivers/regulator/tps80031-regulator.c | 30 |
1 files changed, 5 insertions, 25 deletions
diff --git a/drivers/regulator/tps80031-regulator.c b/drivers/regulator/tps80031-regulator.c index 6511d0bfd896..71f457a42623 100644 --- a/drivers/regulator/tps80031-regulator.c +++ b/drivers/regulator/tps80031-regulator.c | |||
@@ -719,7 +719,7 @@ static int tps80031_regulator_probe(struct platform_device *pdev) | |||
719 | if (ret < 0) { | 719 | if (ret < 0) { |
720 | dev_err(&pdev->dev, | 720 | dev_err(&pdev->dev, |
721 | "regulator config failed, e %d\n", ret); | 721 | "regulator config failed, e %d\n", ret); |
722 | goto fail; | 722 | return ret; |
723 | } | 723 | } |
724 | 724 | ||
725 | ret = tps80031_power_req_config(pdev->dev.parent, | 725 | ret = tps80031_power_req_config(pdev->dev.parent, |
@@ -727,41 +727,22 @@ static int tps80031_regulator_probe(struct platform_device *pdev) | |||
727 | if (ret < 0) { | 727 | if (ret < 0) { |
728 | dev_err(&pdev->dev, | 728 | dev_err(&pdev->dev, |
729 | "pwr_req config failed, err %d\n", ret); | 729 | "pwr_req config failed, err %d\n", ret); |
730 | goto fail; | 730 | return ret; |
731 | } | 731 | } |
732 | } | 732 | } |
733 | rdev = regulator_register(&ri->rinfo->desc, &config); | 733 | rdev = devm_regulator_register(&pdev->dev, &ri->rinfo->desc, |
734 | &config); | ||
734 | if (IS_ERR(rdev)) { | 735 | if (IS_ERR(rdev)) { |
735 | dev_err(&pdev->dev, | 736 | dev_err(&pdev->dev, |
736 | "register regulator failed %s\n", | 737 | "register regulator failed %s\n", |
737 | ri->rinfo->desc.name); | 738 | ri->rinfo->desc.name); |
738 | ret = PTR_ERR(rdev); | 739 | return PTR_ERR(rdev); |
739 | goto fail; | ||
740 | } | 740 | } |
741 | ri->rdev = rdev; | 741 | ri->rdev = rdev; |
742 | } | 742 | } |
743 | 743 | ||
744 | platform_set_drvdata(pdev, pmic); | 744 | platform_set_drvdata(pdev, pmic); |
745 | return 0; | 745 | return 0; |
746 | fail: | ||
747 | while (--num >= 0) { | ||
748 | ri = &pmic[num]; | ||
749 | regulator_unregister(ri->rdev); | ||
750 | } | ||
751 | return ret; | ||
752 | } | ||
753 | |||
754 | static int tps80031_regulator_remove(struct platform_device *pdev) | ||
755 | { | ||
756 | struct tps80031_regulator *pmic = platform_get_drvdata(pdev); | ||
757 | struct tps80031_regulator *ri = NULL; | ||
758 | int num; | ||
759 | |||
760 | for (num = 0; num < TPS80031_REGULATOR_MAX; ++num) { | ||
761 | ri = &pmic[num]; | ||
762 | regulator_unregister(ri->rdev); | ||
763 | } | ||
764 | return 0; | ||
765 | } | 746 | } |
766 | 747 | ||
767 | static struct platform_driver tps80031_regulator_driver = { | 748 | static struct platform_driver tps80031_regulator_driver = { |
@@ -770,7 +751,6 @@ static struct platform_driver tps80031_regulator_driver = { | |||
770 | .owner = THIS_MODULE, | 751 | .owner = THIS_MODULE, |
771 | }, | 752 | }, |
772 | .probe = tps80031_regulator_probe, | 753 | .probe = tps80031_regulator_probe, |
773 | .remove = tps80031_regulator_remove, | ||
774 | }; | 754 | }; |
775 | 755 | ||
776 | static int __init tps80031_regulator_init(void) | 756 | static int __init tps80031_regulator_init(void) |