aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/s5m8767.c
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2013-08-31 06:57:34 -0400
committerMark Brown <broonie@linaro.org>2013-09-16 19:27:54 -0400
commitf0db475dee8fdae611364829ceb7afcd6aa02166 (patch)
tree899786e8fe3376c3cc0df19a6d295263444d38ab /drivers/regulator/s5m8767.c
parentb707a274455f8f80feab24b999dad9e649c98c9c (diff)
regulator: s5m8767: Covert to devm_regulator_register()
Signed-off-by: Mark Brown <broonie@linaro.org> Acked-by: Sangbeom Kim <sbkim73@samsung.com>
Diffstat (limited to 'drivers/regulator/s5m8767.c')
-rw-r--r--drivers/regulator/s5m8767.c24
1 files changed, 3 insertions, 21 deletions
diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c
index c24448bc43cf..2297fdf9ba7e 100644
--- a/drivers/regulator/s5m8767.c
+++ b/drivers/regulator/s5m8767.c
@@ -910,34 +910,17 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)
910 config.regmap = iodev->regmap; 910 config.regmap = iodev->regmap;
911 config.of_node = pdata->regulators[i].reg_node; 911 config.of_node = pdata->regulators[i].reg_node;
912 912
913 rdev[i] = regulator_register(&regulators[id], &config); 913 rdev[i] = devm_regulator_register(&pdev->dev, &regulators[id],
914 &config);
914 if (IS_ERR(rdev[i])) { 915 if (IS_ERR(rdev[i])) {
915 ret = PTR_ERR(rdev[i]); 916 ret = PTR_ERR(rdev[i]);
916 dev_err(s5m8767->dev, "regulator init failed for %d\n", 917 dev_err(s5m8767->dev, "regulator init failed for %d\n",
917 id); 918 id);
918 rdev[i] = NULL; 919 return ret;
919 goto err;
920 } 920 }
921 } 921 }
922 922
923 return 0; 923 return 0;
924err:
925 for (i = 0; i < s5m8767->num_regulators; i++)
926 regulator_unregister(rdev[i]);
927
928 return ret;
929}
930
931static int s5m8767_pmic_remove(struct platform_device *pdev)
932{
933 struct s5m8767_info *s5m8767 = platform_get_drvdata(pdev);
934 struct regulator_dev **rdev = s5m8767->rdev;
935 int i;
936
937 for (i = 0; i < s5m8767->num_regulators; i++)
938 regulator_unregister(rdev[i]);
939
940 return 0;
941} 924}
942 925
943static const struct platform_device_id s5m8767_pmic_id[] = { 926static const struct platform_device_id s5m8767_pmic_id[] = {
@@ -952,7 +935,6 @@ static struct platform_driver s5m8767_pmic_driver = {
952 .owner = THIS_MODULE, 935 .owner = THIS_MODULE,
953 }, 936 },
954 .probe = s5m8767_pmic_probe, 937 .probe = s5m8767_pmic_probe,
955 .remove = s5m8767_pmic_remove,
956 .id_table = s5m8767_pmic_id, 938 .id_table = s5m8767_pmic_id,
957}; 939};
958 940