Skip to content

Commit c7dccca

Browse files
Guru Das Srinageshthierryreding
authored andcommitted
pwm: sun4i: Use nsecs_to_jiffies to avoid a division
Since the PWM framework is switching struct pwm_state.period's datatype to u64, prepare for this transition by using nsecs_to_jiffies() which does away with the need for a division operation. Signed-off-by: Guru Das Srinagesh <[email protected]> Acked-by: Chen-Yu Tsai <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
1 parent 4cc2343 commit c7dccca

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/pwm/pwm-sun4i.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
285285
val = (duty & PWM_DTY_MASK) | PWM_PRD(period);
286286
sun4i_pwm_writel(sun4i_pwm, val, PWM_CH_PRD(pwm->hwpwm));
287287
sun4i_pwm->next_period[pwm->hwpwm] = jiffies +
288-
usecs_to_jiffies(cstate.period / 1000 + 1);
288+
nsecs_to_jiffies(cstate.period + 1000);
289289

290290
if (state->polarity != PWM_POLARITY_NORMAL)
291291
ctrl &= ~BIT_CH(PWM_ACT_STATE, pwm->hwpwm);

0 commit comments

Comments
 (0)