Skip to content

Commit 4cc2343

Browse files
Guru Das Srinageshthierryreding
authored andcommitted
pwm: sifive: Use 64-bit division macro
Since the PWM framework is switching struct pwm_args.period's datatype to u64, prepare for this transition by using DIV64_U64_ROUND_CLOSEST to handle a 64-bit divisor. Signed-off-by: Guru Das Srinagesh <[email protected]> Acked-by: Palmer Dabbelt <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
1 parent 5bc5d99 commit 4cc2343

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/pwm/pwm-sifive.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ static int pwm_sifive_apply(struct pwm_chip *chip, struct pwm_device *pwm,
181181
* consecutively
182182
*/
183183
num = (u64)duty_cycle * (1U << PWM_SIFIVE_CMPWIDTH);
184-
frac = DIV_ROUND_CLOSEST_ULL(num, state->period);
184+
frac = DIV64_U64_ROUND_CLOSEST(num, state->period);
185185
/* The hardware cannot generate a 100% duty cycle */
186186
frac = min(frac, (1U << PWM_SIFIVE_CMPWIDTH) - 1);
187187

0 commit comments

Comments
 (0)