Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1180553

[PATCH] regulator: qcom_spmi-regulator: Use DIV_ROUND_UP instead of open-coded

From Axel Lin <axel.lin@ingics.com>
Newsgroups linux.kernel
Subject [PATCH] regulator: qcom_spmi-regulator: Use DIV_ROUND_UP instead of open-coded
Date 2015-07-09 10:50 +0200
Message-ID <pKfGO-6mA-3@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/regulator/qcom_spmi-regulator.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/regulator/qcom_spmi-regulator.c b/drivers/regulator/qcom_spmi-regulator.c
index 850a30a..9ef0e2f 100644
--- a/drivers/regulator/qcom_spmi-regulator.c
+++ b/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) {
-- 
2.1.0



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] regulator: qcom_spmi-regulator: Use DIV_ROUND_UP instead of  open-coded Axel Lin <axel.lin@ingics.com> - 2015-07-09 10:50 +0200
  Applied "regulator: qcom_spmi-regulator: Use DIV_ROUND_UP instead of open-coded" to the regulator tree Mark Brown <broonie@kernel.org> - 2015-07-10 02:30 +0200

csiph-web