diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-02-19 07:42:52 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-02-19 07:42:52 -0500 |
commit | cf1466fbf8274d35a04d63a3f057b67d91afd671 (patch) | |
tree | ffe64b4b39c35046fef745439c1f6a3d5cc06ff4 /drivers/regulator/max8997.c | |
parent | c99f21c2763f2071dc09eb4cb26cff866e19a1c5 (diff) | |
parent | 86f6673325e38274c55f3df9f919d9a618f100d4 (diff) |
Merge remote-tracking branch 'regulator/topic/of' into regulator-next
Diffstat (limited to 'drivers/regulator/max8997.c')
-rw-r--r-- | drivers/regulator/max8997.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/regulator/max8997.c b/drivers/regulator/max8997.c index 5556a15743fd..0ac7a87519b4 100644 --- a/drivers/regulator/max8997.c +++ b/drivers/regulator/max8997.c | |||
@@ -917,7 +917,7 @@ static int max8997_pmic_dt_parse_pdata(struct platform_device *pdev, | |||
917 | struct max8997_regulator_data *rdata; | 917 | struct max8997_regulator_data *rdata; |
918 | unsigned int i, dvs_voltage_nr = 1, ret; | 918 | unsigned int i, dvs_voltage_nr = 1, ret; |
919 | 919 | ||
920 | pmic_np = iodev->dev->of_node; | 920 | pmic_np = of_node_get(iodev->dev->of_node); |
921 | if (!pmic_np) { | 921 | if (!pmic_np) { |
922 | dev_err(&pdev->dev, "could not find pmic sub-node\n"); | 922 | dev_err(&pdev->dev, "could not find pmic sub-node\n"); |
923 | return -ENODEV; | 923 | return -ENODEV; |
@@ -930,13 +930,12 @@ static int max8997_pmic_dt_parse_pdata(struct platform_device *pdev, | |||
930 | } | 930 | } |
931 | 931 | ||
932 | /* count the number of regulators to be supported in pmic */ | 932 | /* count the number of regulators to be supported in pmic */ |
933 | pdata->num_regulators = 0; | 933 | pdata->num_regulators = of_get_child_count(regulators_np); |
934 | for_each_child_of_node(regulators_np, reg_np) | ||
935 | pdata->num_regulators++; | ||
936 | 934 | ||
937 | rdata = devm_kzalloc(&pdev->dev, sizeof(*rdata) * | 935 | rdata = devm_kzalloc(&pdev->dev, sizeof(*rdata) * |
938 | pdata->num_regulators, GFP_KERNEL); | 936 | pdata->num_regulators, GFP_KERNEL); |
939 | if (!rdata) { | 937 | if (!rdata) { |
938 | of_node_put(regulators_np); | ||
940 | dev_err(&pdev->dev, "could not allocate memory for regulator data\n"); | 939 | dev_err(&pdev->dev, "could not allocate memory for regulator data\n"); |
941 | return -ENOMEM; | 940 | return -ENOMEM; |
942 | } | 941 | } |
@@ -959,6 +958,7 @@ static int max8997_pmic_dt_parse_pdata(struct platform_device *pdev, | |||
959 | rdata->reg_node = reg_np; | 958 | rdata->reg_node = reg_np; |
960 | rdata++; | 959 | rdata++; |
961 | } | 960 | } |
961 | of_node_put(regulators_np); | ||
962 | 962 | ||
963 | if (of_get_property(pmic_np, "max8997,pmic-buck1-uses-gpio-dvs", NULL)) | 963 | if (of_get_property(pmic_np, "max8997,pmic-buck1-uses-gpio-dvs", NULL)) |
964 | pdata->buck1_gpiodvs = true; | 964 | pdata->buck1_gpiodvs = true; |