public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] regulator: max8649: Use DIV_ROUND_UP macro to calculate selector
@ 2012-03-08  2:05 Axel Lin
  2012-03-08 18:07 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2012-03-08  2:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jonghwan Choi, Haojian Zhuang, Mark Brown, Liam Girdwood

Use DIV_ROUND_UP macro for better readability.

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

diff --git a/drivers/regulator/max8649.c b/drivers/regulator/max8649.c
index f724644..824c650 100644
--- a/drivers/regulator/max8649.c
+++ b/drivers/regulator/max8649.c
@@ -101,8 +101,7 @@ static int max8649_set_voltage(struct regulator_dev *rdev,
 			min_uV, max_uV);
 		return -EINVAL;
 	}
-	data = (min_uV - MAX8649_DCDC_VMIN + MAX8649_DCDC_STEP - 1)
-		/ MAX8649_DCDC_STEP;
+	data = DIV_ROUND_UP(min_uV - MAX8649_DCDC_VMIN, MAX8649_DCDC_STEP);
 	mask = MAX8649_VOL_MASK;
 	*selector = data & mask;
 
-- 
1.7.5.4




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

* Re: [PATCH] regulator: max8649: Use DIV_ROUND_UP macro to calculate selector
  2012-03-08  2:05 [PATCH] regulator: max8649: Use DIV_ROUND_UP macro to calculate selector Axel Lin
@ 2012-03-08 18:07 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2012-03-08 18:07 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Jonghwan Choi, Haojian Zhuang, Liam Girdwood

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

On Thu, Mar 08, 2012 at 10:05:24AM +0800, Axel Lin wrote:
> Use DIV_ROUND_UP macro for better readability.

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-03-08 18:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-08  2:05 [PATCH] regulator: max8649: Use DIV_ROUND_UP macro to calculate selector Axel Lin
2012-03-08 18:07 ` Mark Brown

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