From 361e6e9246d2b7f13dc57d11e0589cc6cafb50bd Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 2 Mar 2012 09:19:02 +0800 Subject: [PATCH] --- yaml --- r: 292039 b: refs/heads/master c: 48ee1160a44b6f404f5553a6fce8447507982311 h: refs/heads/master i: 292037: 816516c4f1d5ffe4969042dfd78723eb7bae06f4 292035: d9782e16c6fc721713af7bdc4d987e12adf9991a 292031: 7e1c100d77610f94bfa0a6d4aa8caee16029571c v: v3 --- [refs] | 2 +- trunk/drivers/regulator/isl6271a-regulator.c | 14 +++----------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/[refs] b/[refs] index ab1a9f3bd32b..2708da940540 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 7b94791be6fb1c52c5ccb2cfde793da6c6b541b0 +refs/heads/master: 48ee1160a44b6f404f5553a6fce8447507982311 diff --git a/trunk/drivers/regulator/isl6271a-regulator.c b/trunk/drivers/regulator/isl6271a-regulator.c index c1a456c4257c..775f5fd208c3 100644 --- a/trunk/drivers/regulator/isl6271a-regulator.c +++ b/trunk/drivers/regulator/isl6271a-regulator.c @@ -63,23 +63,15 @@ static int isl6271a_set_voltage(struct regulator_dev *dev, unsigned *selector) { struct isl_pmic *pmic = rdev_get_drvdata(dev); - int vsel, err, data; + int err, data; if (minuV < ISL6271A_VOLTAGE_MIN || minuV > ISL6271A_VOLTAGE_MAX) return -EINVAL; if (maxuV < ISL6271A_VOLTAGE_MIN || maxuV > ISL6271A_VOLTAGE_MAX) return -EINVAL; - /* Align to 50000 mV */ - vsel = minuV - (minuV % ISL6271A_VOLTAGE_STEP); - - /* If the result fell out of [minuV,maxuV] range, put it back */ - if (vsel < minuV) - vsel += ISL6271A_VOLTAGE_STEP; - - /* Convert the microvolts to data for the chip */ - data = (vsel - ISL6271A_VOLTAGE_MIN) / ISL6271A_VOLTAGE_STEP; - + data = DIV_ROUND_UP(minuV - ISL6271A_VOLTAGE_MIN, + ISL6271A_VOLTAGE_STEP); *selector = data; mutex_lock(&pmic->mtx);