All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] regulator: Fix the logic to ensure new voltage setting in valid range
@ 2012-04-11 12:53 Axel Lin
  2012-04-17 14:17 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2012-04-11 12:53 UTC (permalink / raw)
  To: linux-kernel; +Cc: Kyungmin Park, MyungJoo Ham, Liam Girdwood, Mark Brown

I think this is a typo.
To ensure new voltage setting won't greater than desc->max,
the equation should be desc->min + desc->step * new_val <= desc->max.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/regulator/max8997.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/regulator/max8997.c b/drivers/regulator/max8997.c
index db09244..77feeeb 100644
--- a/drivers/regulator/max8997.c
+++ b/drivers/regulator/max8997.c
@@ -682,7 +682,7 @@ static int max8997_set_voltage_buck(struct regulator_dev *rdev,
 		}
 
 		new_val++;
-	} while (desc->min + desc->step + new_val <= desc->max);
+	} while (desc->min + desc->step * new_val <= desc->max);
 
 	new_idx = tmp_idx;
 	new_val = tmp_val;
-- 
1.7.5.4




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

* Re: [PATCH] regulator: Fix the logic to ensure new voltage setting in valid range
  2012-04-11 12:53 [PATCH] regulator: Fix the logic to ensure new voltage setting in valid range Axel Lin
@ 2012-04-17 14:17 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2012-04-17 14:17 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Kyungmin Park, MyungJoo Ham, Liam Girdwood

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

On Wed, Apr 11, 2012 at 08:53:58PM +0800, Axel Lin wrote:
> I think this is a typo.
> To ensure new voltage setting won't greater than desc->max,
> the equation should be desc->min + desc->step * new_val <= desc->max.

Applied, thanks.

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

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

end of thread, other threads:[~2012-04-17 14:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-11 12:53 [PATCH] regulator: Fix the logic to ensure new voltage setting in valid range Axel Lin
2012-04-17 14:17 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.