2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2025-01-11 15:14:03 +08:00

regulator: qcom_spmi-regulator: Use DIV_ROUND_UP instead of open-coded

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Andy Gross <agross@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Axel Lin 2015-07-09 16:48:50 +08:00 committed by Mark Brown
parent d770e558e2
commit 5d506a5ad4

View File

@ -504,8 +504,7 @@ static int spmi_regulator_select_voltage(struct spmi_regulator *vreg,
* Force uV to be an allowed set point by applying a ceiling function to * Force uV to be an allowed set point by applying a ceiling function to
* the uV value. * the uV value.
*/ */
*voltage_sel = (uV - range->min_uV + range->step_uV - 1) *voltage_sel = DIV_ROUND_UP(uV - range->min_uV, range->step_uV);
/ range->step_uV;
uV = *voltage_sel * range->step_uV + range->min_uV; uV = *voltage_sel * range->step_uV + range->min_uV;
if (uV > max_uV) { if (uV > max_uV) {