public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] regulator: qcom_spmi: Fix calculating number of voltages
@ 2015-06-18  0:50 Axel Lin
  2015-06-18  1:04 ` Stephen Boyd
  2015-06-19 15:28 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Axel Lin @ 2015-06-18  0:50 UTC (permalink / raw)
  To: Mark Brown
  Cc: Stephen Boyd, Liam Girdwood, linux-kernel@vger.kernel.org,
	Andy Gross

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




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] regulator: qcom_spmi: Fix calculating number of voltages
  2015-06-18  0:50 [PATCH] regulator: qcom_spmi: Fix calculating number of voltages Axel Lin
@ 2015-06-18  1:04 ` Stephen Boyd
  2015-06-19 15:28 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2015-06-18  1:04 UTC (permalink / raw)
  To: Axel Lin, Mark Brown
  Cc: Liam Girdwood, linux-kernel@vger.kernel.org, Andy Gross

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] regulator: qcom_spmi: Fix calculating number of voltages
  2015-06-18  0:50 [PATCH] regulator: qcom_spmi: Fix calculating number of voltages Axel Lin
  2015-06-18  1:04 ` Stephen Boyd
@ 2015-06-19 15:28 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2015-06-19 15:28 UTC (permalink / raw)
  To: Axel Lin
  Cc: Stephen Boyd, Liam Girdwood, linux-kernel@vger.kernel.org,
	Andy Gross

[-- Attachment #1: Type: text/plain, Size: 173 bytes --]

On Thu, Jun 18, 2015 at 08:50:39AM +0800, Axel Lin wrote:
> n /= range->step_uV + 1; is equivalent to n /= (range->step_uV + 1);
> which is wrong. Fix it.

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-06-19 15:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-18  0:50 [PATCH] regulator: qcom_spmi: Fix calculating number of voltages Axel Lin
2015-06-18  1:04 ` Stephen Boyd
2015-06-19 15:28 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox