aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <k.kozlowski@samsung.com>2014-04-07 08:15:24 -0400
committerMark Brown <broonie@linaro.org>2014-04-14 12:03:41 -0400
commite80fb721cac4202253939451678c873a222be2fa (patch)
tree82d36e6faa6b8735e75d0d7bdcd24067590b5a09
parentc9eaa447e77efe77b7fa4c953bd62de8297fd6c5 (diff)
regulator: s5m8767: Remove regulator_dev pointer from state container
Don't store pointer to regulator_dev returned by devm_regulator_register() in state container. It isn't used anywhere outside of probe. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--drivers/regulator/s5m8767.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c
index 92f19a005dc3..5daa06626f16 100644
--- a/drivers/regulator/s5m8767.c
+++ b/drivers/regulator/s5m8767.c
@@ -28,7 +28,6 @@ struct s5m8767_info {
28 struct device *dev; 28 struct device *dev;
29 struct sec_pmic_dev *iodev; 29 struct sec_pmic_dev *iodev;
30 int num_regulators; 30 int num_regulators;
31 struct regulator_dev **rdev;
32 struct sec_opmode_data *opmode; 31 struct sec_opmode_data *opmode;
33 32
34 int ramp_delay; 33 int ramp_delay;
@@ -695,7 +694,6 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)
695 struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent); 694 struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);
696 struct sec_platform_data *pdata = iodev->pdata; 695 struct sec_platform_data *pdata = iodev->pdata;
697 struct regulator_config config = { }; 696 struct regulator_config config = { };
698 struct regulator_dev **rdev;
699 struct s5m8767_info *s5m8767; 697 struct s5m8767_info *s5m8767;
700 int i, ret, size, buck_init; 698 int i, ret, size, buck_init;
701 699
@@ -737,11 +735,7 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)
737 return -ENOMEM; 735 return -ENOMEM;
738 736
739 size = sizeof(struct regulator_dev *) * (S5M8767_REG_MAX - 2); 737 size = sizeof(struct regulator_dev *) * (S5M8767_REG_MAX - 2);
740 s5m8767->rdev = devm_kzalloc(&pdev->dev, size, GFP_KERNEL);
741 if (!s5m8767->rdev)
742 return -ENOMEM;
743 738
744 rdev = s5m8767->rdev;
745 s5m8767->dev = &pdev->dev; 739 s5m8767->dev = &pdev->dev;
746 s5m8767->iodev = iodev; 740 s5m8767->iodev = iodev;
747 s5m8767->num_regulators = pdata->num_regulators; 741 s5m8767->num_regulators = pdata->num_regulators;
@@ -938,6 +932,7 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)
938 const struct sec_voltage_desc *desc; 932 const struct sec_voltage_desc *desc;
939 int id = pdata->regulators[i].id; 933 int id = pdata->regulators[i].id;
940 int enable_reg, enable_val; 934 int enable_reg, enable_val;
935 struct regulator_dev *rdev;
941 936
942 desc = reg_voltage_map[id]; 937 desc = reg_voltage_map[id];
943 if (desc) { 938 if (desc) {
@@ -969,21 +964,21 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)
969 s5m8767_regulator_config_ext_control(s5m8767, 964 s5m8767_regulator_config_ext_control(s5m8767,
970 &pdata->regulators[i], &config); 965 &pdata->regulators[i], &config);
971 966
972 rdev[i] = devm_regulator_register(&pdev->dev, &regulators[id], 967 rdev = devm_regulator_register(&pdev->dev, &regulators[id],
973 &config); 968 &config);
974 if (IS_ERR(rdev[i])) { 969 if (IS_ERR(rdev)) {
975 ret = PTR_ERR(rdev[i]); 970 ret = PTR_ERR(rdev);
976 dev_err(s5m8767->dev, "regulator init failed for %d\n", 971 dev_err(s5m8767->dev, "regulator init failed for %d\n",
977 id); 972 id);
978 return ret; 973 return ret;
979 } 974 }
980 975
981 if (pdata->regulators[i].ext_control_gpio) { 976 if (pdata->regulators[i].ext_control_gpio) {
982 ret = s5m8767_enable_ext_control(s5m8767, rdev[i]); 977 ret = s5m8767_enable_ext_control(s5m8767, rdev);
983 if (ret < 0) { 978 if (ret < 0) {
984 dev_err(s5m8767->dev, 979 dev_err(s5m8767->dev,
985 "failed to enable gpio control over %s: %d\n", 980 "failed to enable gpio control over %s: %d\n",
986 rdev[i]->desc->name, ret); 981 rdev->desc->name, ret);
987 return ret; 982 return ret;
988 } 983 }
989 } 984 }