diff options
Diffstat (limited to 'drivers/regulator/max8907-regulator.c')
-rw-r--r-- | drivers/regulator/max8907-regulator.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/regulator/max8907-regulator.c b/drivers/regulator/max8907-regulator.c index 0c5fe6c6ac26..9623e9e290bf 100644 --- a/drivers/regulator/max8907-regulator.c +++ b/drivers/regulator/max8907-regulator.c | |||
@@ -34,7 +34,6 @@ | |||
34 | 34 | ||
35 | struct max8907_regulator { | 35 | struct max8907_regulator { |
36 | struct regulator_desc desc[MAX8907_NUM_REGULATORS]; | 36 | struct regulator_desc desc[MAX8907_NUM_REGULATORS]; |
37 | struct regulator_dev *rdev[MAX8907_NUM_REGULATORS]; | ||
38 | }; | 37 | }; |
39 | 38 | ||
40 | #define REG_MBATT() \ | 39 | #define REG_MBATT() \ |
@@ -231,7 +230,7 @@ static int max8907_regulator_parse_dt(struct platform_device *pdev) | |||
231 | if (!np) | 230 | if (!np) |
232 | return 0; | 231 | return 0; |
233 | 232 | ||
234 | regulators = of_find_node_by_name(np, "regulators"); | 233 | regulators = of_get_child_by_name(np, "regulators"); |
235 | if (!regulators) { | 234 | if (!regulators) { |
236 | dev_err(&pdev->dev, "regulators node not found\n"); | 235 | dev_err(&pdev->dev, "regulators node not found\n"); |
237 | return -EINVAL; | 236 | return -EINVAL; |
@@ -292,10 +291,9 @@ static int max8907_regulator_probe(struct platform_device *pdev) | |||
292 | return ret; | 291 | return ret; |
293 | 292 | ||
294 | pmic = devm_kzalloc(&pdev->dev, sizeof(*pmic), GFP_KERNEL); | 293 | pmic = devm_kzalloc(&pdev->dev, sizeof(*pmic), GFP_KERNEL); |
295 | if (!pmic) { | 294 | if (!pmic) |
296 | dev_err(&pdev->dev, "Failed to alloc pmic\n"); | ||
297 | return -ENOMEM; | 295 | return -ENOMEM; |
298 | } | 296 | |
299 | platform_set_drvdata(pdev, pmic); | 297 | platform_set_drvdata(pdev, pmic); |
300 | 298 | ||
301 | memcpy(pmic->desc, max8907_regulators, sizeof(pmic->desc)); | 299 | memcpy(pmic->desc, max8907_regulators, sizeof(pmic->desc)); |
@@ -311,6 +309,8 @@ static int max8907_regulator_probe(struct platform_device *pdev) | |||
311 | } | 309 | } |
312 | 310 | ||
313 | for (i = 0; i < MAX8907_NUM_REGULATORS; i++) { | 311 | for (i = 0; i < MAX8907_NUM_REGULATORS; i++) { |
312 | struct regulator_dev *rdev; | ||
313 | |||
314 | config.dev = pdev->dev.parent; | 314 | config.dev = pdev->dev.parent; |
315 | if (pdata) | 315 | if (pdata) |
316 | idata = pdata->init_data[i]; | 316 | idata = pdata->init_data[i]; |
@@ -350,13 +350,13 @@ static int max8907_regulator_probe(struct platform_device *pdev) | |||
350 | pmic->desc[i].ops = &max8907_out5v_hwctl_ops; | 350 | pmic->desc[i].ops = &max8907_out5v_hwctl_ops; |
351 | } | 351 | } |
352 | 352 | ||
353 | pmic->rdev[i] = devm_regulator_register(&pdev->dev, | 353 | rdev = devm_regulator_register(&pdev->dev, |
354 | &pmic->desc[i], &config); | 354 | &pmic->desc[i], &config); |
355 | if (IS_ERR(pmic->rdev[i])) { | 355 | if (IS_ERR(rdev)) { |
356 | dev_err(&pdev->dev, | 356 | dev_err(&pdev->dev, |
357 | "failed to register %s regulator\n", | 357 | "failed to register %s regulator\n", |
358 | pmic->desc[i].name); | 358 | pmic->desc[i].name); |
359 | return PTR_ERR(pmic->rdev[i]); | 359 | return PTR_ERR(rdev); |
360 | } | 360 | } |
361 | } | 361 | } |
362 | 362 | ||