pwm: imx-tpm: Use 64-bit division macro
authorGuru Das Srinagesh <gurus@codeaurora.org>
Tue, 2 Jun 2020 22:31:09 +0000 (15:31 -0700)
committerThierry Reding <thierry.reding@gmail.com>
Tue, 16 Jun 2020 09:16:08 +0000 (11:16 +0200)
Since the PWM framework is switching struct pwm_state.period's datatype
to u64, prepare for this transition by using DIV64_U64_ROUND_CLOSEST to
handle a 64-bit divisor.

Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: NXP Linux Team <linux-imx@nxp.com>
Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/pwm-imx-tpm.c

index 5f3d7f7e6aef0aa4a738a4bd28ff84e8814a6cf7..fcdf6befb83898de984402bd4c957217ccbad80d 100644 (file)
@@ -124,7 +124,7 @@ static int pwm_imx_tpm_round_state(struct pwm_chip *chip,
                real_state->duty_cycle = state->duty_cycle;
 
        tmp = (u64)p->mod * real_state->duty_cycle;
-       p->val = DIV_ROUND_CLOSEST_ULL(tmp, real_state->period);
+       p->val = DIV64_U64_ROUND_CLOSEST(tmp, real_state->period);
 
        real_state->polarity = state->polarity;
        real_state->enabled = state->enabled;