From: Axel Lin Date: Wed, 9 Jan 2013 11:34:57 +0000 (+0800) Subject: regulator: max8998: Ensure enough delay time for max8998_set_voltage_buck_time_sel X-Git-Tag: v3.7.3~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0e3f380e4da94e19a2e32fa00a144bed52aa561a;p=thirdparty%2Fkernel%2Fstable.git regulator: max8998: Ensure enough delay time for max8998_set_voltage_buck_time_sel 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 Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/regulator/max8998.c b/drivers/regulator/max8998.c index 9f980c321b87e..6a200196c3a8e 100644 --- a/drivers/regulator/max8998.c +++ b/drivers/regulator/max8998.c @@ -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; }