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)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Thu, 10 Jan 2013 12:55:49 +0000 (12:55 +0000)
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>
Cc: stable@vger.kernel.org
drivers/regulator/max8998.c

index 06be8cc7aadf8f572b0b447de65f24b9bfc470d7..1f0df4046b86d0a303c229379091d76407f61129 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;
 }