backlight: pwm_bl: Use 64-bit division function
authorGuru Das Srinagesh <gurus@codeaurora.org>
Tue, 2 Jun 2020 22:31:14 +0000 (15:31 -0700)
committerThierry Reding <thierry.reding@gmail.com>
Wed, 17 Jun 2020 18:42:10 +0000 (20:42 +0200)
Since the PWM framework is switching struct pwm_state.period's datatype
to u64, prepare for this transition by using div_u64 to handle a 64-bit
dividend instead of a straight division operation.

Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/video/backlight/pwm_bl.c

index 82b8d7594701d00e9b4fab22c346e55dc92bcc7a..464baade8f5275c0df6e6854d7d74c8c11b5601d 100644 (file)
@@ -606,7 +606,8 @@ static int pwm_backlight_probe(struct platform_device *pdev)
                pb->scale = data->max_brightness;
        }
 
-       pb->lth_brightness = data->lth_brightness * (state.period / pb->scale);
+       pb->lth_brightness = data->lth_brightness * (div_u64(state.period,
+                               pb->scale));
 
        props.type = BACKLIGHT_RAW;
        props.max_brightness = data->max_brightness;