diff options
Diffstat (limited to 'drivers/regulator/max77686.c')
-rw-r--r-- | drivers/regulator/max77686.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/regulator/max77686.c b/drivers/regulator/max77686.c index ae001ccf26f4..ef1af2debbd2 100644 --- a/drivers/regulator/max77686.c +++ b/drivers/regulator/max77686.c | |||
@@ -65,7 +65,6 @@ enum max77686_ramp_rate { | |||
65 | }; | 65 | }; |
66 | 66 | ||
67 | struct max77686_data { | 67 | struct max77686_data { |
68 | struct regulator_dev *rdev[MAX77686_REGULATORS]; | ||
69 | unsigned int opmode[MAX77686_REGULATORS]; | 68 | unsigned int opmode[MAX77686_REGULATORS]; |
70 | }; | 69 | }; |
71 | 70 | ||
@@ -400,7 +399,7 @@ static int max77686_pmic_dt_parse_pdata(struct platform_device *pdev, | |||
400 | unsigned int i; | 399 | unsigned int i; |
401 | 400 | ||
402 | pmic_np = iodev->dev->of_node; | 401 | pmic_np = iodev->dev->of_node; |
403 | regulators_np = of_find_node_by_name(pmic_np, "voltage-regulators"); | 402 | regulators_np = of_get_child_by_name(pmic_np, "voltage-regulators"); |
404 | if (!regulators_np) { | 403 | if (!regulators_np) { |
405 | dev_err(&pdev->dev, "could not find regulators sub-node\n"); | 404 | dev_err(&pdev->dev, "could not find regulators sub-node\n"); |
406 | return -EINVAL; | 405 | return -EINVAL; |
@@ -410,8 +409,7 @@ static int max77686_pmic_dt_parse_pdata(struct platform_device *pdev, | |||
410 | rdata = devm_kzalloc(&pdev->dev, sizeof(*rdata) * | 409 | rdata = devm_kzalloc(&pdev->dev, sizeof(*rdata) * |
411 | pdata->num_regulators, GFP_KERNEL); | 410 | pdata->num_regulators, GFP_KERNEL); |
412 | if (!rdata) { | 411 | if (!rdata) { |
413 | dev_err(&pdev->dev, | 412 | of_node_put(regulators_np); |
414 | "could not allocate memory for regulator data\n"); | ||
415 | return -ENOMEM; | 413 | return -ENOMEM; |
416 | } | 414 | } |
417 | 415 | ||
@@ -425,6 +423,7 @@ static int max77686_pmic_dt_parse_pdata(struct platform_device *pdev, | |||
425 | } | 423 | } |
426 | 424 | ||
427 | pdata->regulators = rdata; | 425 | pdata->regulators = rdata; |
426 | of_node_put(regulators_np); | ||
428 | 427 | ||
429 | return 0; | 428 | return 0; |
430 | } | 429 | } |
@@ -474,16 +473,18 @@ static int max77686_pmic_probe(struct platform_device *pdev) | |||
474 | platform_set_drvdata(pdev, max77686); | 473 | platform_set_drvdata(pdev, max77686); |
475 | 474 | ||
476 | for (i = 0; i < MAX77686_REGULATORS; i++) { | 475 | for (i = 0; i < MAX77686_REGULATORS; i++) { |
476 | struct regulator_dev *rdev; | ||
477 | |||
477 | config.init_data = pdata->regulators[i].initdata; | 478 | config.init_data = pdata->regulators[i].initdata; |
478 | config.of_node = pdata->regulators[i].of_node; | 479 | config.of_node = pdata->regulators[i].of_node; |
479 | 480 | ||
480 | max77686->opmode[i] = regulators[i].enable_mask; | 481 | max77686->opmode[i] = regulators[i].enable_mask; |
481 | max77686->rdev[i] = devm_regulator_register(&pdev->dev, | 482 | rdev = devm_regulator_register(&pdev->dev, |
482 | ®ulators[i], &config); | 483 | ®ulators[i], &config); |
483 | if (IS_ERR(max77686->rdev[i])) { | 484 | if (IS_ERR(rdev)) { |
484 | dev_err(&pdev->dev, | 485 | dev_err(&pdev->dev, |
485 | "regulator init failed for %d\n", i); | 486 | "regulator init failed for %d\n", i); |
486 | return PTR_ERR(max77686->rdev[i]); | 487 | return PTR_ERR(rdev); |
487 | } | 488 | } |
488 | } | 489 | } |
489 | 490 | ||