diff options
author | Nishanth Menon <nm@ti.com> | 2016-05-05 20:29:52 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-05-06 13:15:18 -0400 |
commit | 6c7d614fa22d32d038b5a6e88d71acb2711e7035 (patch) | |
tree | 85b3ff35f34d8f1c9022b52fbd32649010fa57ff /drivers/regulator/palmas-regulator.c | |
parent | 7f091e53c9efc52b2b3a03a8a1d479a47956fecd (diff) |
regulator: tps65917/palmas: Simplify multiple dereference of match->of_node
Just dereference match->of_node once instead of using match->of_node.
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator/palmas-regulator.c')
-rw-r--r-- | drivers/regulator/palmas-regulator.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c index faa389be7ca3..f11d41dad9c1 100644 --- a/drivers/regulator/palmas-regulator.c +++ b/drivers/regulator/palmas-regulator.c | |||
@@ -1493,10 +1493,12 @@ static int palmas_dt_to_pdata(struct device *dev, | |||
1493 | for (idx = 0; idx < ddata->max_reg; idx++) { | 1493 | for (idx = 0; idx < ddata->max_reg; idx++) { |
1494 | static struct of_regulator_match *match; | 1494 | static struct of_regulator_match *match; |
1495 | struct palmas_reg_init *rinit; | 1495 | struct palmas_reg_init *rinit; |
1496 | struct device_node *np; | ||
1496 | 1497 | ||
1497 | match = &ddata->palmas_matches[idx]; | 1498 | match = &ddata->palmas_matches[idx]; |
1499 | np = match->of_node; | ||
1498 | 1500 | ||
1499 | if (!match->init_data || !match->of_node) | 1501 | if (!match->init_data || !np) |
1500 | continue; | 1502 | continue; |
1501 | 1503 | ||
1502 | rinit = devm_kzalloc(dev, sizeof(*rinit), GFP_KERNEL); | 1504 | rinit = devm_kzalloc(dev, sizeof(*rinit), GFP_KERNEL); |
@@ -1506,11 +1508,8 @@ static int palmas_dt_to_pdata(struct device *dev, | |||
1506 | pdata->reg_data[idx] = match->init_data; | 1508 | pdata->reg_data[idx] = match->init_data; |
1507 | pdata->reg_init[idx] = rinit; | 1509 | pdata->reg_init[idx] = rinit; |
1508 | 1510 | ||
1509 | rinit->warm_reset = of_property_read_bool(match->of_node, | 1511 | rinit->warm_reset = of_property_read_bool(np, "ti,warm-reset"); |
1510 | "ti,warm-reset"); | 1512 | ret = of_property_read_u32(np, "ti,roof-floor", &prop); |
1511 | |||
1512 | ret = of_property_read_u32(match->of_node, "ti,roof-floor", | ||
1513 | &prop); | ||
1514 | /* EINVAL: Property not found */ | 1513 | /* EINVAL: Property not found */ |
1515 | if (ret != -EINVAL) { | 1514 | if (ret != -EINVAL) { |
1516 | int econtrol; | 1515 | int econtrol; |
@@ -1539,19 +1538,17 @@ static int palmas_dt_to_pdata(struct device *dev, | |||
1539 | rinit->roof_floor = econtrol; | 1538 | rinit->roof_floor = econtrol; |
1540 | } | 1539 | } |
1541 | 1540 | ||
1542 | ret = of_property_read_u32(match->of_node, "ti,mode-sleep", | 1541 | ret = of_property_read_u32(np, "ti,mode-sleep", &prop); |
1543 | &prop); | ||
1544 | if (!ret) | 1542 | if (!ret) |
1545 | rinit->mode_sleep = prop; | 1543 | rinit->mode_sleep = prop; |
1546 | 1544 | ||
1547 | ret = of_property_read_bool(match->of_node, "ti,smps-range"); | 1545 | ret = of_property_read_bool(np, "ti,smps-range"); |
1548 | if (ret) | 1546 | if (ret) |
1549 | rinit->vsel = PALMAS_SMPS12_VOLTAGE_RANGE; | 1547 | rinit->vsel = PALMAS_SMPS12_VOLTAGE_RANGE; |
1550 | 1548 | ||
1551 | if (idx == PALMAS_REG_LDO8) | 1549 | if (idx == PALMAS_REG_LDO8) |
1552 | pdata->enable_ldo8_tracking = of_property_read_bool( | 1550 | pdata->enable_ldo8_tracking = of_property_read_bool( |
1553 | match->of_node, | 1551 | np, "ti,enable-ldo8-tracking"); |
1554 | "ti,enable-ldo8-tracking"); | ||
1555 | } | 1552 | } |
1556 | 1553 | ||
1557 | pdata->ldo6_vibrator = of_property_read_bool(node, "ti,ldo6-vibrator"); | 1554 | pdata->ldo6_vibrator = of_property_read_bool(node, "ti,ldo6-vibrator"); |