drm/amd/display: Fix 64-bit division for 32-bit builds
authorKen Chalmers <ken.chalmers@amd.com>
Wed, 19 Dec 2018 19:50:20 +0000 (14:50 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 14 Jan 2019 20:04:45 +0000 (15:04 -0500)
[Why]
32-bit builds break when doing 64-bit division directly.

[How]
Use the div_u64() function instead to perform the division.

Fixes: https://lists.freedesktop.org/archives/dri-devel/2018-December/201008.html
Signed-off-by: Ken Chalmers <ken.chalmers@amd.com>
Reviewed-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dce80/dce80_timing_generator.c

index 5c629ae487ec994a138ae4155bfd4efaf4022d9d..8b5ce557ee7180a3c6878a5650f7ff64c8ca2781 100644 (file)
@@ -94,7 +94,7 @@ static void program_pix_dur(struct timing_generator *tg, uint32_t pix_clk_100hz)
        if (pix_clk_100hz == 0)
                return;
 
-       pix_dur = 10000000000ull / pix_clk_100hz;
+       pix_dur = div_u64(10000000000ull, pix_clk_100hz);
 
        set_reg_field_value(
                value,