Message ID | a1942f735fa4d3eb71546a3f07d9b5e78fd7919a.1584667964.git.gurus@codeaurora.org |
---|---|
State | Superseded |
Headers | show |
Series | [v11,01/12] drm/i915: Use 64-bit division macro | expand |
On Fri, Mar 20, 2020 at 2:42 AM Guru Das Srinagesh <gurus@codeaurora.org> wrote: > sun4i_pwm->next_period[pwm->hwpwm] = jiffies + > - usecs_to_jiffies(cstate.period / 1000 + 1); > + usecs_to_jiffies(div_u64(cstate.period, 1000) + 1); > sun4i_pwm->needs_delay[pwm->hwpwm] = true; > This one looks like it should use nsecs_to_jiffies(cstate.period) to avoid having two 64-bit divisions. Arnd
diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c index 3e3efa6..772fdf4 100644 --- a/drivers/pwm/pwm-sun4i.c +++ b/drivers/pwm/pwm-sun4i.c @@ -286,7 +286,7 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, val = (duty & PWM_DTY_MASK) | PWM_PRD(period); sun4i_pwm_writel(sun4i_pwm, val, PWM_CH_PRD(pwm->hwpwm)); sun4i_pwm->next_period[pwm->hwpwm] = jiffies + - usecs_to_jiffies(cstate.period / 1000 + 1); + usecs_to_jiffies(div_u64(cstate.period, 1000) + 1); sun4i_pwm->needs_delay[pwm->hwpwm] = true; if (state->polarity != PWM_POLARITY_NORMAL)