Re: [PATCH] regulator: of: removing two variables min_uV and max_uV

From: Mark Brown
Date: Mon Nov 02 2015 - 03:53:51 EST


On Sat, Oct 31, 2015 at 08:31:31PM +0530, Saurabh Sengar wrote:

> - min_uV = of_get_property(np, "regulator-min-microvolt", NULL);
> - if (min_uV)
> - constraints->min_uV = be32_to_cpu(*min_uV);

> + if (!of_property_read_u32(np, "regulator-max-microvolt", &pval))
> + constraints->max_uV = pval;

> /* 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->apply_uV = true;

Your new code is not equivalent to the existing code. The new code will
set apply_uV even if the DT properties are not present which will in
turn mean that we will end up attempting to apply a setting of 0V if
that happens which is not desirable.

Attachment: signature.asc
Description: PGP signature