Re: [PATCH 2/5] regulator: tps65911: Add new chip version

From: Stephen Boyd
Date: Tue May 03 2011 - 12:31:21 EST


On 05/03/2011 09:18 AM, Jorge Eduardo Candelaria wrote:
> @@ -419,17 +541,21 @@ static int tps65910_get_voltage_dcdc(struct regulator_dev *dev)
> mult=1;
>
> if (sr) {
> - /* Valid range is 3-75 so normalise */
> - if (srvsel < 3) srvsel = 3;
> - if (srvsel > 75) srvsel = 75;
> + /* normalise to valid range */
> + if (srvsel < 3)
> + srvsel = 3;
> + if (srvsel > vselmax)
> + srvsel = vselmax;
> srvsel -= 3;
>
> voltage = (srvsel * VDD1_2_OFFSET + VDD1_2_MIN_VOLT) * 100;
> } else {
>
> - /* Valid range is 3-75 so normalise */
> - if (opvsel < 3) opvsel = 3;
> - if (opvsel > 75) opvsel = 75;
> + /* normalise to valid range*/
> + if (opvsel < 3)
> + opvsel = 3;
> + if (opvsel > vselmax)
> + opvsel = vselmax;

Can we use clamp() instead?

--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/