linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] regulator: wm831x-dcdc: Ensure selected voltage falls within requested range
@ 2012-11-30  5:19 Axel Lin
  2012-12-02 15:12 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2012-11-30  5:19 UTC (permalink / raw)
  To: Mark Brown; +Cc: Liam Girdwood, linux-kernel

Use DIV_ROUND_UP to ensure selected voltage won't less than min_uV due to
integer truncation.

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

diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c
index bce2565..96450f1 100644
--- a/drivers/regulator/wm831x-dcdc.c
+++ b/drivers/regulator/wm831x-dcdc.c
@@ -223,7 +223,7 @@ static int wm831x_buckv_map_voltage(struct regulator_dev *rdev,
 	if (min_uV < 600000)
 		vsel = 0;
 	else if (min_uV <= 1800000)
-		vsel = ((min_uV - 600000) / 12500) + 8;
+		vsel = DIV_ROUND_UP(min_uV - 600000, 12500) + 8;
 	else
 		return -EINVAL;
 
-- 
1.7.9.5




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

* Re: [PATCH] regulator: wm831x-dcdc: Ensure selected voltage falls within requested range
  2012-11-30  5:19 [PATCH] regulator: wm831x-dcdc: Ensure selected voltage falls within requested range Axel Lin
@ 2012-12-02 15:12 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2012-12-02 15:12 UTC (permalink / raw)
  To: Axel Lin; +Cc: Liam Girdwood, linux-kernel

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

On Fri, Nov 30, 2012 at 01:19:33PM +0800, Axel Lin wrote:
> Use DIV_ROUND_UP to ensure selected voltage won't less than min_uV due to
> integer truncation.

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-12-02 15:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-30  5:19 [PATCH] regulator: wm831x-dcdc: Ensure selected voltage falls within requested range Axel Lin
2012-12-02 15:12 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).