lkml.org 
[lkml]   [2020]   [May]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v15 08/11] pwm: sun4i: Use nsecs_to_jiffies to avoid a division
    Date
    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 <gurus@codeaurora.org>
    Acked-by: Chen-Yu Tsai <wens@csie.org>
    ---
    drivers/pwm/pwm-sun4i.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c
    index 5c677c5..1694e69 100644
    --- a/drivers/pwm/pwm-sun4i.c
    +++ b/drivers/pwm/pwm-sun4i.c
    @@ -285,7 +285,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);
    + nsecs_to_jiffies(cstate.period + 1000);

    if (state->polarity != PWM_POLARITY_NORMAL)
    ctrl &= ~BIT_CH(PWM_ACT_STATE, pwm->hwpwm);
    --
    The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
    a Linux Foundation Collaborative Project
    \
     
     \ /
      Last update: 2020-05-26 19:36    [W:3.624 / U:0.332 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site