]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
regulator: max8998: Ensure enough delay time for max8998_set_voltage_buck_time_sel
authorAxel Lin <axel.lin@ingics.com>
Wed, 9 Jan 2013 11:34:57 +0000 (19:34 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Jan 2013 16:46:39 +0000 (08:46 -0800)
commit 81d0a6ae7befb24c06f4aa4856af7f8d1f612171 upstream.

Use DIV_ROUND_UP to prevent truncation by integer division issue.
This ensures we return enough delay time.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/regulator/max8998.c

index 9f980c321b87e117278e30d38c1bb2da9e100d65..6a200196c3a8e56a23d4eacd9a24e636e4f17a75 100644 (file)
@@ -447,7 +447,7 @@ static int max8998_set_voltage_buck_time_sel(struct regulator_dev *rdev,
 
        difference = (new_selector - old_selector) * desc->step / 1000;
        if (difference > 0)
-               return difference / ((val & 0x0f) + 1);
+               return DIV_ROUND_UP(difference, (val & 0x0f) + 1);
 
        return 0;
 }