hwmon: pwm-fan: Use 64-bit division macro
authorGuru Das Srinagesh <gurus@codeaurora.org>
Tue, 2 Jun 2020 22:31:06 +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_args.period's datatype
to u64, prepare for this transition by using DIV_ROUND_UP_ULL to handle
a 64-bit dividend.

Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/hwmon/pwm-fan.c

index 30b7b3ea8836fc97318091ffa548f3e632bd2bf4..17bb64299bfd83bd553202110f7599fdcb3bad8d 100644 (file)
@@ -447,7 +447,7 @@ static int pwm_fan_resume(struct device *dev)
                return 0;
 
        pwm_get_args(ctx->pwm, &pargs);
-       duty = DIV_ROUND_UP(ctx->pwm_value * (pargs.period - 1), MAX_PWM);
+       duty = DIV_ROUND_UP_ULL(ctx->pwm_value * (pargs.period - 1), MAX_PWM);
        ret = pwm_config(ctx->pwm, duty, pargs.period);
        if (ret)
                return ret;