* [PATCH] regulator: max8925: Use DIV_ROUND_UP macro
@ 2012-03-13 8:09 Axel Lin
2012-03-13 23:20 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2012-03-13 8:09 UTC (permalink / raw)
To: linux-kernel; +Cc: Haojian Zhuang, Liam Girdwood, Mark Brown
Use DIV_ROUND_UP macro for better readability.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
This one replaces "[PATCH] regulator: max8925: Use DIV_ROUND_UP in max8925_set_dvm_voltage".
drivers/regulator/max8925-regulator.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/regulator/max8925-regulator.c b/drivers/regulator/max8925-regulator.c
index cc290d3..2f242f4 100644
--- a/drivers/regulator/max8925-regulator.c
+++ b/drivers/regulator/max8925-regulator.c
@@ -73,7 +73,7 @@ static int max8925_set_voltage(struct regulator_dev *rdev,
min_uV, max_uV);
return -EINVAL;
}
- data = (min_uV - info->min_uV + info->step_uV - 1) / info->step_uV;
+ data = DIV_ROUND_UP(min_uV - info->min_uV, info->step_uV);
*selector = data;
data <<= info->vol_shift;
mask = ((1 << info->vol_nbits) - 1) << info->vol_shift;
@@ -140,7 +140,7 @@ static int max8925_set_dvm_voltage(struct regulator_dev *rdev, int uV)
if (uV < SD1_DVM_VMIN || uV > SD1_DVM_VMAX)
return -EINVAL;
- data = (uV - SD1_DVM_VMIN + SD1_DVM_STEP - 1) / SD1_DVM_STEP;
+ data = DIV_ROUND_UP(uV - SD1_DVM_VMIN, SD1_DVM_STEP);
data <<= SD1_DVM_SHIFT;
mask = 3 << SD1_DVM_SHIFT;
--
1.7.5.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-03-13 23:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-13 8:09 [PATCH] regulator: max8925: Use DIV_ROUND_UP macro Axel Lin
2012-03-13 23:20 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox