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.2.38~97 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=e8d9897ff064b1683c11c15ea1296a67a45d77b0;p=karo-tx-linux.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 [bwh: Backported to 3.2: delay is done by driver, not returned to the caller] Signed-off-by: Ben Hutchings --- diff --git a/drivers/regulator/max8998.c b/drivers/regulator/max8998.c index 41a1495eec2b..27fe1c6ed45c 100644 --- a/drivers/regulator/max8998.c +++ b/drivers/regulator/max8998.c @@ -497,7 +497,7 @@ buck2_exit: difference = desc->min + desc->step*i - previous_vol/1000; if (difference > 0) - udelay(difference / ((val & 0x0f) + 1)); + udelay(DIV_ROUND_UP(difference, (val & 0x0f) + 1)); return ret; }