Commit a34785f1 authored by Laxman Dewangan's avatar Laxman Dewangan Committed by Mark Brown

regulator: of: Use of_property_read_u32() for reading min/max

OF interface provides to read the u32 value via standard interface
of_property_read_u32(). Use this API to read "regulator-min-microvolts"
and "regulator-max-microvolt".

This will make consistent with other property value reads.
Signed-off-by: default avatarLaxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 92e963f5
...@@ -28,7 +28,6 @@ static void of_get_regulation_constraints(struct device_node *np, ...@@ -28,7 +28,6 @@ static void of_get_regulation_constraints(struct device_node *np,
struct regulator_init_data **init_data, struct regulator_init_data **init_data,
const struct regulator_desc *desc) const struct regulator_desc *desc)
{ {
const __be32 *min_uV, *max_uV;
struct regulation_constraints *constraints = &(*init_data)->constraints; struct regulation_constraints *constraints = &(*init_data)->constraints;
struct regulator_state *suspend_state; struct regulator_state *suspend_state;
struct device_node *suspend_np; struct device_node *suspend_np;
...@@ -37,18 +36,18 @@ static void of_get_regulation_constraints(struct device_node *np, ...@@ -37,18 +36,18 @@ static void of_get_regulation_constraints(struct device_node *np,
constraints->name = of_get_property(np, "regulator-name", NULL); constraints->name = of_get_property(np, "regulator-name", NULL);
min_uV = of_get_property(np, "regulator-min-microvolt", NULL); if (!of_property_read_u32(np, "regulator-min-microvolt", &pval))
if (min_uV) constraints->min_uV = pval;
constraints->min_uV = be32_to_cpu(*min_uV);
max_uV = of_get_property(np, "regulator-max-microvolt", NULL); if (!of_property_read_u32(np, "regulator-max-microvolt", &pval))
if (max_uV) constraints->max_uV = pval;
constraints->max_uV = be32_to_cpu(*max_uV);
/* Voltage change possible? */ /* Voltage change possible? */
if (constraints->min_uV != constraints->max_uV) if (constraints->min_uV != constraints->max_uV)
constraints->valid_ops_mask |= REGULATOR_CHANGE_VOLTAGE; constraints->valid_ops_mask |= REGULATOR_CHANGE_VOLTAGE;
/* Only one voltage? Then make sure it's set. */ /* Only one voltage? Then make sure it's set. */
if (min_uV && max_uV && constraints->min_uV == constraints->max_uV) if (constraints->min_uV && constraints->max_uV &&
constraints->min_uV == constraints->max_uV)
constraints->apply_uV = true; constraints->apply_uV = true;
if (!of_property_read_u32(np, "regulator-microvolt-offset", &pval)) if (!of_property_read_u32(np, "regulator-microvolt-offset", &pval))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment