Browse Source

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>
Axel Lin 10 năm trước cách đây
mục cha
commit
5d506a5ad4
1 tập tin đã thay đổi với 1 bổ sung2 xóa
  1. 1 2
      drivers/regulator/qcom_spmi-regulator.c

+ 1 - 2
drivers/regulator/qcom_spmi-regulator.c

@@ -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) {