diff options
Diffstat (limited to 'drivers/regulator/max8997.c')
-rw-r--r-- | drivers/regulator/max8997.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/drivers/regulator/max8997.c b/drivers/regulator/max8997.c index 2d618fc9c1af..90b4c530dee5 100644 --- a/drivers/regulator/max8997.c +++ b/drivers/regulator/max8997.c | |||
@@ -38,7 +38,6 @@ struct max8997_data { | |||
38 | struct device *dev; | 38 | struct device *dev; |
39 | struct max8997_dev *iodev; | 39 | struct max8997_dev *iodev; |
40 | int num_regulators; | 40 | int num_regulators; |
41 | struct regulator_dev **rdev; | ||
42 | int ramp_delay; /* in mV/us */ | 41 | int ramp_delay; /* in mV/us */ |
43 | 42 | ||
44 | bool buck1_gpiodvs; | 43 | bool buck1_gpiodvs; |
@@ -924,7 +923,7 @@ static int max8997_pmic_dt_parse_pdata(struct platform_device *pdev, | |||
924 | return -ENODEV; | 923 | return -ENODEV; |
925 | } | 924 | } |
926 | 925 | ||
927 | regulators_np = of_find_node_by_name(pmic_np, "regulators"); | 926 | regulators_np = of_get_child_by_name(pmic_np, "regulators"); |
928 | if (!regulators_np) { | 927 | if (!regulators_np) { |
929 | dev_err(&pdev->dev, "could not find regulators sub-node\n"); | 928 | dev_err(&pdev->dev, "could not find regulators sub-node\n"); |
930 | return -EINVAL; | 929 | return -EINVAL; |
@@ -937,7 +936,6 @@ static int max8997_pmic_dt_parse_pdata(struct platform_device *pdev, | |||
937 | pdata->num_regulators, GFP_KERNEL); | 936 | pdata->num_regulators, GFP_KERNEL); |
938 | if (!rdata) { | 937 | if (!rdata) { |
939 | of_node_put(regulators_np); | 938 | of_node_put(regulators_np); |
940 | dev_err(&pdev->dev, "could not allocate memory for regulator data\n"); | ||
941 | return -ENOMEM; | 939 | return -ENOMEM; |
942 | } | 940 | } |
943 | 941 | ||
@@ -1030,10 +1028,10 @@ static int max8997_pmic_probe(struct platform_device *pdev) | |||
1030 | struct max8997_dev *iodev = dev_get_drvdata(pdev->dev.parent); | 1028 | struct max8997_dev *iodev = dev_get_drvdata(pdev->dev.parent); |
1031 | struct max8997_platform_data *pdata = iodev->pdata; | 1029 | struct max8997_platform_data *pdata = iodev->pdata; |
1032 | struct regulator_config config = { }; | 1030 | struct regulator_config config = { }; |
1033 | struct regulator_dev **rdev; | 1031 | struct regulator_dev *rdev; |
1034 | struct max8997_data *max8997; | 1032 | struct max8997_data *max8997; |
1035 | struct i2c_client *i2c; | 1033 | struct i2c_client *i2c; |
1036 | int i, ret, size, nr_dvs; | 1034 | int i, ret, nr_dvs; |
1037 | u8 max_buck1 = 0, max_buck2 = 0, max_buck5 = 0; | 1035 | u8 max_buck1 = 0, max_buck2 = 0, max_buck5 = 0; |
1038 | 1036 | ||
1039 | if (!pdata) { | 1037 | if (!pdata) { |
@@ -1052,12 +1050,6 @@ static int max8997_pmic_probe(struct platform_device *pdev) | |||
1052 | if (!max8997) | 1050 | if (!max8997) |
1053 | return -ENOMEM; | 1051 | return -ENOMEM; |
1054 | 1052 | ||
1055 | size = sizeof(struct regulator_dev *) * pdata->num_regulators; | ||
1056 | max8997->rdev = devm_kzalloc(&pdev->dev, size, GFP_KERNEL); | ||
1057 | if (!max8997->rdev) | ||
1058 | return -ENOMEM; | ||
1059 | |||
1060 | rdev = max8997->rdev; | ||
1061 | max8997->dev = &pdev->dev; | 1053 | max8997->dev = &pdev->dev; |
1062 | max8997->iodev = iodev; | 1054 | max8997->iodev = iodev; |
1063 | max8997->num_regulators = pdata->num_regulators; | 1055 | max8997->num_regulators = pdata->num_regulators; |
@@ -1205,12 +1197,12 @@ static int max8997_pmic_probe(struct platform_device *pdev) | |||
1205 | config.driver_data = max8997; | 1197 | config.driver_data = max8997; |
1206 | config.of_node = pdata->regulators[i].reg_node; | 1198 | config.of_node = pdata->regulators[i].reg_node; |
1207 | 1199 | ||
1208 | rdev[i] = devm_regulator_register(&pdev->dev, ®ulators[id], | 1200 | rdev = devm_regulator_register(&pdev->dev, ®ulators[id], |
1209 | &config); | 1201 | &config); |
1210 | if (IS_ERR(rdev[i])) { | 1202 | if (IS_ERR(rdev)) { |
1211 | dev_err(max8997->dev, "regulator init failed for %d\n", | 1203 | dev_err(max8997->dev, "regulator init failed for %d\n", |
1212 | id); | 1204 | id); |
1213 | return PTR_ERR(rdev[i]); | 1205 | return PTR_ERR(rdev); |
1214 | } | 1206 | } |
1215 | } | 1207 | } |
1216 | 1208 | ||