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


Groups > linux.kernel > #1167510 > unrolled thread

[PATCH] regulator: qcom_spmi: Fix calculating number of voltages

Started byAxel Lin <axel.lin@ingics.com>
First post2015-06-18 03:00 +0200
Last post2015-06-18 03:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] regulator: qcom_spmi: Fix calculating number of voltages Axel Lin <axel.lin@ingics.com> - 2015-06-18 03:00 +0200
    Re: [PATCH] regulator: qcom_spmi: Fix calculating number of voltages Stephen Boyd <sboyd@codeaurora.org> - 2015-06-18 03:10 +0200

#1167510 — [PATCH] regulator: qcom_spmi: Fix calculating number of voltages

FromAxel Lin <axel.lin@ingics.com>
Date2015-06-18 03:00 +0200
Subject[PATCH] regulator: qcom_spmi: Fix calculating number of voltages
Message-ID<pCwls-1az-1@gated-at.bofh.it>
n /= range->step_uV + 1; is equivalent to n /= (range->step_uV + 1);
which is wrong. Fix it.

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

diff --git a/drivers/regulator/qcom_spmi-regulator.c b/drivers/regulator/qcom_spmi-regulator.c
index 162b865..42a60b4 100644
--- a/drivers/regulator/qcom_spmi-regulator.c
+++ b/drivers/regulator/qcom_spmi-regulator.c
@@ -1108,7 +1108,7 @@ static void spmi_calculate_num_voltages(struct spmi_voltage_set_points *points)
 		n = 0;
 		if (range->set_point_max_uV) {
 			n = range->set_point_max_uV - range->set_point_min_uV;
-			n /= range->step_uV + 1;
+			n = (n / range->step_uV) + 1;
 		}
 		range->n_voltages = n;
 		points->n_voltages += n;
-- 
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/

[toc] | [next] | [standalone]


#1167516

FromStephen Boyd <sboyd@codeaurora.org>
Date2015-06-18 03:10 +0200
Message-ID<pCwv9-1Bh-11@gated-at.bofh.it>
In reply to#1167510
On 06/17/2015 05:50 PM, Axel Lin wrote:
> n /= range->step_uV + 1; is equivalent to n /= (range->step_uV + 1);
> which is wrong. Fix it.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---

Acked-by: Stephen Boyd <sboyd@codeaurora.org>

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

--
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/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web