Commit af857f1c authored by Axel Lin's avatar Axel Lin Committed by Greg Kroah-Hartman

regulator: max8998: Ensure enough delay time for max8998_set_voltage_buck_time_sel

commit e8d9897f upstream.

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>
Cc: Qiang Huang <h.huangqiang@huawei.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent cd858528
......@@ -492,7 +492,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