OSDN Git Service

regulator: qcom_spmi-regulator: Use DIV_ROUND_UP instead of open-coded
authorAxel Lin <axel.lin@ingics.com>
Thu, 9 Jul 2015 08:48:50 +0000 (16:48 +0800)
committerMark Brown <broonie@kernel.org>
Thu, 9 Jul 2015 18:02:42 +0000 (19:02 +0100)
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Andy Gross <agross@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/qcom_spmi-regulator.c

index 850a30a..9ef0e2f 100644 (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
         * the uV value.
         */
-       *voltage_sel = (uV - range->min_uV + range->step_uV - 1)
-                       / range->step_uV;
+       *voltage_sel = DIV_ROUND_UP(uV - range->min_uV, range->step_uV);
        uV = *voltage_sel * range->step_uV + range->min_uV;
 
        if (uV > max_uV) {