Commit 5db6d09a2b4663735121dfe4222860424788a93f
Committed by
Mark Brown
1 parent
42b5efe4f9
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
regulator: max8925: Use DIV_ROUND_UP macro
Use DIV_ROUND_UP macro for better readability. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Showing 1 changed file with 2 additions and 2 deletions Side-by-side Diff
drivers/regulator/max8925-regulator.c
... | ... | @@ -73,7 +73,7 @@ |
73 | 73 | min_uV, max_uV); |
74 | 74 | return -EINVAL; |
75 | 75 | } |
76 | - data = (min_uV - info->min_uV + info->step_uV - 1) / info->step_uV; | |
76 | + data = DIV_ROUND_UP(min_uV - info->min_uV, info->step_uV); | |
77 | 77 | *selector = data; |
78 | 78 | data <<= info->vol_shift; |
79 | 79 | mask = ((1 << info->vol_nbits) - 1) << info->vol_shift; |
... | ... | @@ -140,7 +140,7 @@ |
140 | 140 | if (uV < SD1_DVM_VMIN || uV > SD1_DVM_VMAX) |
141 | 141 | return -EINVAL; |
142 | 142 | |
143 | - data = (uV - SD1_DVM_VMIN + SD1_DVM_STEP - 1) / SD1_DVM_STEP; | |
143 | + data = DIV_ROUND_UP(uV - SD1_DVM_VMIN, SD1_DVM_STEP); | |
144 | 144 | data <<= SD1_DVM_SHIFT; |
145 | 145 | mask = 3 << SD1_DVM_SHIFT; |
146 | 146 |