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 b85040caaea3..cca18a3c0294 100644 --- a/drivers/regulator/max77686.c +++ b/drivers/regulator/max77686.c | |||
@@ -379,9 +379,10 @@ static struct regulator_desc regulators[] = { | |||
379 | }; | 379 | }; |
380 | 380 | ||
381 | #ifdef CONFIG_OF | 381 | #ifdef CONFIG_OF |
382 | static int max77686_pmic_dt_parse_pdata(struct max77686_dev *iodev, | 382 | static int max77686_pmic_dt_parse_pdata(struct platform_device *pdev, |
383 | struct max77686_platform_data *pdata) | 383 | struct max77686_platform_data *pdata) |
384 | { | 384 | { |
385 | struct max77686_dev *iodev = dev_get_drvdata(pdev->dev.parent); | ||
385 | struct device_node *pmic_np, *regulators_np; | 386 | struct device_node *pmic_np, *regulators_np; |
386 | struct max77686_regulator_data *rdata; | 387 | struct max77686_regulator_data *rdata; |
387 | struct of_regulator_match rmatch; | 388 | struct of_regulator_match rmatch; |
@@ -390,15 +391,15 @@ static int max77686_pmic_dt_parse_pdata(struct max77686_dev *iodev, | |||
390 | pmic_np = iodev->dev->of_node; | 391 | pmic_np = iodev->dev->of_node; |
391 | regulators_np = of_find_node_by_name(pmic_np, "voltage-regulators"); | 392 | regulators_np = of_find_node_by_name(pmic_np, "voltage-regulators"); |
392 | if (!regulators_np) { | 393 | if (!regulators_np) { |
393 | dev_err(iodev->dev, "could not find regulators sub-node\n"); | 394 | dev_err(&pdev->dev, "could not find regulators sub-node\n"); |
394 | return -EINVAL; | 395 | return -EINVAL; |
395 | } | 396 | } |
396 | 397 | ||
397 | pdata->num_regulators = ARRAY_SIZE(regulators); | 398 | pdata->num_regulators = ARRAY_SIZE(regulators); |
398 | rdata = devm_kzalloc(iodev->dev, sizeof(*rdata) * | 399 | rdata = devm_kzalloc(&pdev->dev, sizeof(*rdata) * |
399 | pdata->num_regulators, GFP_KERNEL); | 400 | pdata->num_regulators, GFP_KERNEL); |
400 | if (!rdata) { | 401 | if (!rdata) { |
401 | dev_err(iodev->dev, | 402 | dev_err(&pdev->dev, |
402 | "could not allocate memory for regulator data\n"); | 403 | "could not allocate memory for regulator data\n"); |
403 | return -ENOMEM; | 404 | return -ENOMEM; |
404 | } | 405 | } |
@@ -407,7 +408,7 @@ static int max77686_pmic_dt_parse_pdata(struct max77686_dev *iodev, | |||
407 | rmatch.name = regulators[i].name; | 408 | rmatch.name = regulators[i].name; |
408 | rmatch.init_data = NULL; | 409 | rmatch.init_data = NULL; |
409 | rmatch.of_node = NULL; | 410 | rmatch.of_node = NULL; |
410 | of_regulator_match(iodev->dev, regulators_np, &rmatch, 1); | 411 | of_regulator_match(&pdev->dev, regulators_np, &rmatch, 1); |
411 | rdata[i].initdata = rmatch.init_data; | 412 | rdata[i].initdata = rmatch.init_data; |
412 | rdata[i].of_node = rmatch.of_node; | 413 | rdata[i].of_node = rmatch.of_node; |
413 | } | 414 | } |
@@ -417,7 +418,7 @@ static int max77686_pmic_dt_parse_pdata(struct max77686_dev *iodev, | |||
417 | return 0; | 418 | return 0; |
418 | } | 419 | } |
419 | #else | 420 | #else |
420 | static int max77686_pmic_dt_parse_pdata(struct max77686_dev *iodev, | 421 | static int max77686_pmic_dt_parse_pdata(struct platform_device *pdev, |
421 | struct max77686_platform_data *pdata) | 422 | struct max77686_platform_data *pdata) |
422 | { | 423 | { |
423 | return 0; | 424 | return 0; |
@@ -440,7 +441,7 @@ static int max77686_pmic_probe(struct platform_device *pdev) | |||
440 | } | 441 | } |
441 | 442 | ||
442 | if (iodev->dev->of_node) { | 443 | if (iodev->dev->of_node) { |
443 | ret = max77686_pmic_dt_parse_pdata(iodev, pdata); | 444 | ret = max77686_pmic_dt_parse_pdata(pdev, pdata); |
444 | if (ret) | 445 | if (ret) |
445 | return ret; | 446 | return ret; |
446 | } | 447 | } |