[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20090825183955.GA2724@opensource.wolfsonmicro.com>
Date: Tue, 25 Aug 2009 19:39:56 +0100
From: Mark Brown <broonie@...nsource.wolfsonmicro.com>
To: Roel Kluin <roel.kluin@...il.com>
Cc: Liam Girdwood <lrg@...mlogic.co.uk>,
Mike Rapoport <mike@...pulab.co.il>, eric.y.miao@...il.com,
linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] regulator: fix calculation of voltage range in
da9034_set_ldo12_voltage()
On Tue, Aug 25, 2009 at 03:42:00PM +0200, Roel Kluin wrote:
> For val to be greater than 7 or less than 20 is logically always true.
> Signed-off-by: Roel Kluin <roel.kluin@...il.com>
Looks good to me but CCing in Eric and Mike just in case the intent of
the code was something other than the new version.
> diff --git a/drivers/regulator/da903x.c b/drivers/regulator/da903x.c
> index b8b89ef..2d9bde5 100644
> --- a/drivers/regulator/da903x.c
> +++ b/drivers/regulator/da903x.c
> @@ -278,7 +278,7 @@ static int da9034_set_ldo12_voltage(struct regulator_dev *rdev,
> }
>
> val = (min_uV - info->min_uV + info->step_uV - 1) / info->step_uV;
> - val = (val > 7 || val < 20) ? 8 : val - 12;
> + val = (val > 7 && val < 20) ? 8 : val - 12;
> val <<= info->vol_shift;
> mask = ((1 << info->vol_nbits) - 1) << info->vol_shift;
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists