diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2013-09-04 02:31:00 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-09-16 19:28:42 -0400 |
commit | 8c0b4ab5024c7b7d3498957cdbe4fea151142f7a (patch) | |
tree | 28a958ec1aa3f7463847192fe54037c09cc0e772 | |
parent | 8e568635afcce245d771c2fc527f3902b6d2e723 (diff) |
regulator: mc13892: Use devm_regulator_register
devm_* simplifies the code.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Marek Vasut <marex@denx.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r-- | drivers/regulator/mc13892-regulator.c | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/drivers/regulator/mc13892-regulator.c b/drivers/regulator/mc13892-regulator.c index 1037e07937cf..96c9f80d9550 100644 --- a/drivers/regulator/mc13892-regulator.c +++ b/drivers/regulator/mc13892-regulator.c | |||
@@ -611,43 +611,27 @@ static int mc13892_regulator_probe(struct platform_device *pdev) | |||
611 | config.driver_data = priv; | 611 | config.driver_data = priv; |
612 | config.of_node = node; | 612 | config.of_node = node; |
613 | 613 | ||
614 | priv->regulators[i] = regulator_register(desc, &config); | 614 | priv->regulators[i] = devm_regulator_register(&pdev->dev, desc, |
615 | &config); | ||
615 | if (IS_ERR(priv->regulators[i])) { | 616 | if (IS_ERR(priv->regulators[i])) { |
616 | dev_err(&pdev->dev, "failed to register regulator %s\n", | 617 | dev_err(&pdev->dev, "failed to register regulator %s\n", |
617 | mc13892_regulators[i].desc.name); | 618 | mc13892_regulators[i].desc.name); |
618 | ret = PTR_ERR(priv->regulators[i]); | 619 | return PTR_ERR(priv->regulators[i]); |
619 | goto err; | ||
620 | } | 620 | } |
621 | } | 621 | } |
622 | 622 | ||
623 | return 0; | 623 | return 0; |
624 | err: | ||
625 | while (--i >= 0) | ||
626 | regulator_unregister(priv->regulators[i]); | ||
627 | return ret; | ||
628 | 624 | ||
629 | err_unlock: | 625 | err_unlock: |
630 | mc13xxx_unlock(mc13892); | 626 | mc13xxx_unlock(mc13892); |
631 | return ret; | 627 | return ret; |
632 | } | 628 | } |
633 | 629 | ||
634 | static int mc13892_regulator_remove(struct platform_device *pdev) | ||
635 | { | ||
636 | struct mc13xxx_regulator_priv *priv = platform_get_drvdata(pdev); | ||
637 | int i; | ||
638 | |||
639 | for (i = 0; i < priv->num_regulators; i++) | ||
640 | regulator_unregister(priv->regulators[i]); | ||
641 | |||
642 | return 0; | ||
643 | } | ||
644 | |||
645 | static struct platform_driver mc13892_regulator_driver = { | 630 | static struct platform_driver mc13892_regulator_driver = { |
646 | .driver = { | 631 | .driver = { |
647 | .name = "mc13892-regulator", | 632 | .name = "mc13892-regulator", |
648 | .owner = THIS_MODULE, | 633 | .owner = THIS_MODULE, |
649 | }, | 634 | }, |
650 | .remove = mc13892_regulator_remove, | ||
651 | .probe = mc13892_regulator_probe, | 635 | .probe = mc13892_regulator_probe, |
652 | }; | 636 | }; |
653 | 637 | ||