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 | |
parent | c99f21c2763f2071dc09eb4cb26cff866e19a1c5 (diff) | |
parent | 86f6673325e38274c55f3df9f919d9a618f100d4 (diff) |
Merge remote-tracking branch 'regulator/topic/of' into regulator-next
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/88pm8607.c | 3 | ||||
-rw-r--r-- | drivers/regulator/da9052-regulator.c | 5 | ||||
-rw-r--r-- | drivers/regulator/max8907-regulator.c | 7 | ||||
-rw-r--r-- | drivers/regulator/max8925-regulator.c | 3 | ||||
-rw-r--r-- | drivers/regulator/max8997.c | 8 | ||||
-rw-r--r-- | drivers/regulator/mc13xxx-regulator-core.c | 15 | ||||
-rw-r--r-- | drivers/regulator/palmas-regulator.c | 2 | ||||
-rw-r--r-- | drivers/regulator/tps65910-regulator.c | 6 |
8 files changed, 30 insertions, 19 deletions
diff --git a/drivers/regulator/88pm8607.c b/drivers/regulator/88pm8607.c index a957e8c53205..c79ab843333e 100644 --- a/drivers/regulator/88pm8607.c +++ b/drivers/regulator/88pm8607.c | |||
@@ -347,7 +347,7 @@ static int pm8607_regulator_dt_init(struct platform_device *pdev, | |||
347 | struct regulator_config *config) | 347 | struct regulator_config *config) |
348 | { | 348 | { |
349 | struct device_node *nproot, *np; | 349 | struct device_node *nproot, *np; |
350 | nproot = pdev->dev.parent->of_node; | 350 | nproot = of_node_get(pdev->dev.parent->of_node); |
351 | if (!nproot) | 351 | if (!nproot) |
352 | return -ENODEV; | 352 | return -ENODEV; |
353 | nproot = of_find_node_by_name(nproot, "regulators"); | 353 | nproot = of_find_node_by_name(nproot, "regulators"); |
@@ -363,6 +363,7 @@ static int pm8607_regulator_dt_init(struct platform_device *pdev, | |||
363 | break; | 363 | break; |
364 | } | 364 | } |
365 | } | 365 | } |
366 | of_node_put(nproot); | ||
366 | return 0; | 367 | return 0; |
367 | } | 368 | } |
368 | #else | 369 | #else |
diff --git a/drivers/regulator/da9052-regulator.c b/drivers/regulator/da9052-regulator.c index c6d8651fd329..96b569abb46c 100644 --- a/drivers/regulator/da9052-regulator.c +++ b/drivers/regulator/da9052-regulator.c | |||
@@ -366,9 +366,9 @@ static int da9052_regulator_probe(struct platform_device *pdev) | |||
366 | config.init_data = pdata->regulators[pdev->id]; | 366 | config.init_data = pdata->regulators[pdev->id]; |
367 | } else { | 367 | } else { |
368 | #ifdef CONFIG_OF | 368 | #ifdef CONFIG_OF |
369 | struct device_node *nproot = da9052->dev->of_node; | 369 | struct device_node *nproot, *np; |
370 | struct device_node *np; | ||
371 | 370 | ||
371 | nproot = of_node_get(da9052->dev->of_node); | ||
372 | if (!nproot) | 372 | if (!nproot) |
373 | return -ENODEV; | 373 | return -ENODEV; |
374 | 374 | ||
@@ -385,6 +385,7 @@ static int da9052_regulator_probe(struct platform_device *pdev) | |||
385 | break; | 385 | break; |
386 | } | 386 | } |
387 | } | 387 | } |
388 | of_node_put(nproot); | ||
388 | #endif | 389 | #endif |
389 | } | 390 | } |
390 | 391 | ||
diff --git a/drivers/regulator/max8907-regulator.c b/drivers/regulator/max8907-regulator.c index d40cf7fdb546..4568c15fa78d 100644 --- a/drivers/regulator/max8907-regulator.c +++ b/drivers/regulator/max8907-regulator.c | |||
@@ -224,11 +224,11 @@ static struct of_regulator_match max8907_matches[] = { | |||
224 | 224 | ||
225 | static int max8907_regulator_parse_dt(struct platform_device *pdev) | 225 | static int max8907_regulator_parse_dt(struct platform_device *pdev) |
226 | { | 226 | { |
227 | struct device_node *np = pdev->dev.parent->of_node; | 227 | struct device_node *np, *regulators; |
228 | struct device_node *regulators; | ||
229 | int ret; | 228 | int ret; |
230 | 229 | ||
231 | if (!pdev->dev.parent->of_node) | 230 | np = of_node_get(pdev->dev.parent->of_node); |
231 | if (!np) | ||
232 | return 0; | 232 | return 0; |
233 | 233 | ||
234 | regulators = of_find_node_by_name(np, "regulators"); | 234 | regulators = of_find_node_by_name(np, "regulators"); |
@@ -239,6 +239,7 @@ static int max8907_regulator_parse_dt(struct platform_device *pdev) | |||
239 | 239 | ||
240 | ret = of_regulator_match(&pdev->dev, regulators, max8907_matches, | 240 | ret = of_regulator_match(&pdev->dev, regulators, max8907_matches, |
241 | ARRAY_SIZE(max8907_matches)); | 241 | ARRAY_SIZE(max8907_matches)); |
242 | of_node_put(regulators); | ||
242 | if (ret < 0) { | 243 | if (ret < 0) { |
243 | dev_err(&pdev->dev, "Error parsing regulator init data: %d\n", | 244 | dev_err(&pdev->dev, "Error parsing regulator init data: %d\n", |
244 | ret); | 245 | ret); |
diff --git a/drivers/regulator/max8925-regulator.c b/drivers/regulator/max8925-regulator.c index 446a85445553..0d5f64a805a0 100644 --- a/drivers/regulator/max8925-regulator.c +++ b/drivers/regulator/max8925-regulator.c | |||
@@ -252,7 +252,7 @@ static int max8925_regulator_dt_init(struct platform_device *pdev, | |||
252 | { | 252 | { |
253 | struct device_node *nproot, *np; | 253 | struct device_node *nproot, *np; |
254 | int rcount; | 254 | int rcount; |
255 | nproot = pdev->dev.parent->of_node; | 255 | nproot = of_node_get(pdev->dev.parent->of_node); |
256 | if (!nproot) | 256 | if (!nproot) |
257 | return -ENODEV; | 257 | return -ENODEV; |
258 | np = of_find_node_by_name(nproot, "regulators"); | 258 | np = of_find_node_by_name(nproot, "regulators"); |
@@ -263,6 +263,7 @@ static int max8925_regulator_dt_init(struct platform_device *pdev, | |||
263 | 263 | ||
264 | rcount = of_regulator_match(&pdev->dev, np, | 264 | rcount = of_regulator_match(&pdev->dev, np, |
265 | &max8925_regulator_matches[ridx], 1); | 265 | &max8925_regulator_matches[ridx], 1); |
266 | of_node_put(np); | ||
266 | if (rcount < 0) | 267 | if (rcount < 0) |
267 | return -ENODEV; | 268 | return -ENODEV; |
268 | config->init_data = max8925_regulator_matches[ridx].init_data; | 269 | config->init_data = max8925_regulator_matches[ridx].init_data; |
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; |
diff --git a/drivers/regulator/mc13xxx-regulator-core.c b/drivers/regulator/mc13xxx-regulator-core.c index 2ecf1d8b6a94..23cf9f9c383b 100644 --- a/drivers/regulator/mc13xxx-regulator-core.c +++ b/drivers/regulator/mc13xxx-regulator-core.c | |||
@@ -164,17 +164,16 @@ EXPORT_SYMBOL_GPL(mc13xxx_fixed_regulator_ops); | |||
164 | #ifdef CONFIG_OF | 164 | #ifdef CONFIG_OF |
165 | int mc13xxx_get_num_regulators_dt(struct platform_device *pdev) | 165 | int mc13xxx_get_num_regulators_dt(struct platform_device *pdev) |
166 | { | 166 | { |
167 | struct device_node *parent, *child; | 167 | struct device_node *parent; |
168 | int num = 0; | 168 | int num; |
169 | 169 | ||
170 | of_node_get(pdev->dev.parent->of_node); | 170 | of_node_get(pdev->dev.parent->of_node); |
171 | parent = of_find_node_by_name(pdev->dev.parent->of_node, "regulators"); | 171 | parent = of_find_node_by_name(pdev->dev.parent->of_node, "regulators"); |
172 | if (!parent) | 172 | if (!parent) |
173 | return -ENODEV; | 173 | return -ENODEV; |
174 | 174 | ||
175 | for_each_child_of_node(parent, child) | 175 | num = of_get_child_count(parent); |
176 | num++; | 176 | of_node_put(parent); |
177 | |||
178 | return num; | 177 | return num; |
179 | } | 178 | } |
180 | EXPORT_SYMBOL_GPL(mc13xxx_get_num_regulators_dt); | 179 | EXPORT_SYMBOL_GPL(mc13xxx_get_num_regulators_dt); |
@@ -197,8 +196,11 @@ struct mc13xxx_regulator_init_data *mc13xxx_parse_regulators_dt( | |||
197 | 196 | ||
198 | data = devm_kzalloc(&pdev->dev, sizeof(*data) * priv->num_regulators, | 197 | data = devm_kzalloc(&pdev->dev, sizeof(*data) * priv->num_regulators, |
199 | GFP_KERNEL); | 198 | GFP_KERNEL); |
200 | if (!data) | 199 | if (!data) { |
200 | of_node_put(parent); | ||
201 | return NULL; | 201 | return NULL; |
202 | } | ||
203 | |||
202 | p = data; | 204 | p = data; |
203 | 205 | ||
204 | for_each_child_of_node(parent, child) { | 206 | for_each_child_of_node(parent, child) { |
@@ -217,6 +219,7 @@ struct mc13xxx_regulator_init_data *mc13xxx_parse_regulators_dt( | |||
217 | } | 219 | } |
218 | } | 220 | } |
219 | } | 221 | } |
222 | of_node_put(parent); | ||
220 | 223 | ||
221 | *num_parsed = parsed; | 224 | *num_parsed = parsed; |
222 | return data; | 225 | return data; |
diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c index c9e912f583bc..cbaf22627bd3 100644 --- a/drivers/regulator/palmas-regulator.c +++ b/drivers/regulator/palmas-regulator.c | |||
@@ -527,6 +527,7 @@ static void palmas_dt_to_pdata(struct device *dev, | |||
527 | u32 prop; | 527 | u32 prop; |
528 | int idx, ret; | 528 | int idx, ret; |
529 | 529 | ||
530 | node = of_node_get(node); | ||
530 | regulators = of_find_node_by_name(node, "regulators"); | 531 | regulators = of_find_node_by_name(node, "regulators"); |
531 | if (!regulators) { | 532 | if (!regulators) { |
532 | dev_info(dev, "regulator node not found\n"); | 533 | dev_info(dev, "regulator node not found\n"); |
@@ -535,6 +536,7 @@ static void palmas_dt_to_pdata(struct device *dev, | |||
535 | 536 | ||
536 | ret = of_regulator_match(dev, regulators, palmas_matches, | 537 | ret = of_regulator_match(dev, regulators, palmas_matches, |
537 | PALMAS_NUM_REGS); | 538 | PALMAS_NUM_REGS); |
539 | of_node_put(regulators); | ||
538 | if (ret < 0) { | 540 | if (ret < 0) { |
539 | dev_err(dev, "Error parsing regulator init data: %d\n", ret); | 541 | dev_err(dev, "Error parsing regulator init data: %d\n", ret); |
540 | return; | 542 | return; |
diff --git a/drivers/regulator/tps65910-regulator.c b/drivers/regulator/tps65910-regulator.c index b0e4c0bc85c3..6ba6931ac855 100644 --- a/drivers/regulator/tps65910-regulator.c +++ b/drivers/regulator/tps65910-regulator.c | |||
@@ -964,8 +964,7 @@ static struct tps65910_board *tps65910_parse_dt_reg_data( | |||
964 | { | 964 | { |
965 | struct tps65910_board *pmic_plat_data; | 965 | struct tps65910_board *pmic_plat_data; |
966 | struct tps65910 *tps65910 = dev_get_drvdata(pdev->dev.parent); | 966 | struct tps65910 *tps65910 = dev_get_drvdata(pdev->dev.parent); |
967 | struct device_node *np = pdev->dev.parent->of_node; | 967 | struct device_node *np, *regulators; |
968 | struct device_node *regulators; | ||
969 | struct of_regulator_match *matches; | 968 | struct of_regulator_match *matches; |
970 | unsigned int prop; | 969 | unsigned int prop; |
971 | int idx = 0, ret, count; | 970 | int idx = 0, ret, count; |
@@ -978,6 +977,7 @@ static struct tps65910_board *tps65910_parse_dt_reg_data( | |||
978 | return NULL; | 977 | return NULL; |
979 | } | 978 | } |
980 | 979 | ||
980 | np = of_node_get(pdev->dev.parent->of_node); | ||
981 | regulators = of_find_node_by_name(np, "regulators"); | 981 | regulators = of_find_node_by_name(np, "regulators"); |
982 | if (!regulators) { | 982 | if (!regulators) { |
983 | dev_err(&pdev->dev, "regulator node not found\n"); | 983 | dev_err(&pdev->dev, "regulator node not found\n"); |
@@ -994,11 +994,13 @@ static struct tps65910_board *tps65910_parse_dt_reg_data( | |||
994 | matches = tps65911_matches; | 994 | matches = tps65911_matches; |
995 | break; | 995 | break; |
996 | default: | 996 | default: |
997 | of_node_put(regulators); | ||
997 | dev_err(&pdev->dev, "Invalid tps chip version\n"); | 998 | dev_err(&pdev->dev, "Invalid tps chip version\n"); |
998 | return NULL; | 999 | return NULL; |
999 | } | 1000 | } |
1000 | 1001 | ||
1001 | ret = of_regulator_match(&pdev->dev, regulators, matches, count); | 1002 | ret = of_regulator_match(&pdev->dev, regulators, matches, count); |
1003 | of_node_put(regulators); | ||
1002 | if (ret < 0) { | 1004 | if (ret < 0) { |
1003 | dev_err(&pdev->dev, "Error parsing regulator init data: %d\n", | 1005 | dev_err(&pdev->dev, "Error parsing regulator init data: %d\n", |
1004 | ret); | 1006 | ret); |