Commit e8d9897f authored by Axel Lin's avatar Axel Lin Committed by Ben Hutchings

regulator: max8998: Ensure enough delay time for max8998_set_voltage_buck_time_sel

commit 81d0a6ae upstream.

Use DIV_ROUND_UP to prevent truncation by integer division issue.
This ensures we return enough delay time.
Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
[bwh: Backported to 3.2: delay is done by driver, not returned to the caller]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 5b7d898a
......@@ -497,7 +497,7 @@ static int max8998_set_voltage_buck(struct regulator_dev *rdev,
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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment