Re: [PATCH] regulator: wm831x-dcdc: Ensure selected voltage falls within requested range

2012-12-02 Thread Mark Brown
On Fri, Nov 30, 2012 at 01:19:33PM +0800, Axel Lin wrote:
> Use DIV_ROUND_UP to ensure selected voltage won't less than min_uV due to
> integer truncation.

Applied, thanks.


signature.asc
Description: Digital signature


[PATCH] regulator: wm831x-dcdc: Ensure selected voltage falls within requested range

2012-11-29 Thread Axel Lin
Use DIV_ROUND_UP to ensure selected voltage won't less than min_uV due to
integer truncation.

Signed-off-by: Axel Lin 
---
 drivers/regulator/wm831x-dcdc.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c
index bce2565..96450f1 100644
--- a/drivers/regulator/wm831x-dcdc.c
+++ b/drivers/regulator/wm831x-dcdc.c
@@ -223,7 +223,7 @@ static int wm831x_buckv_map_voltage(struct regulator_dev 
*rdev,
if (min_uV < 60)
vsel = 0;
else if (min_uV <= 180)
-   vsel = ((min_uV - 60) / 12500) + 8;
+   vsel = DIV_ROUND_UP(min_uV - 60, 12500) + 8;
else
return -EINVAL;
 
-- 
1.7.9.5



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