[PATCH 17/20] drm/amd/display: Fix issue breaking 32bit Linux build

Pavle Kotarac Pavle.Kotarac at amd.com
Fri Apr 8 17:19:08 UTC 2022


From: Hayden Goodfellow <Hayden.Goodfellow at amd.com>

[Why]
Currently, the 32bit linux build is failing due to an issue with using the
built-in / operator with a 64bit dividend. Doing so generates code which
calls __udivdi3() in libgcc. However, libgcc is not linked with the kernel
at this point in the build, hence this causes the 32bit build to fail to
compile.

[How]
Change the / operator to div_u64 instead.

Reviewed-by: Aric Cyr <Aric.Cyr at amd.com>
Acked-by: Pavle Kotarac <Pavle.Kotarac at amd.com>
Signed-off-by: Hayden Goodfellow <Hayden.Goodfellow at amd.com>
---
 drivers/gpu/drm/amd/display/modules/freesync/freesync.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
index c1d540f017a8..03fa63d56fa6 100644
--- a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
+++ b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
@@ -1242,7 +1242,7 @@ void mod_freesync_handle_v_update(struct mod_freesync *mod_freesync,
 
 	cur_tick = dm_get_timestamp(core_freesync->dc->ctx);
 	cur_timestamp_in_us = (unsigned int)
-			(dm_get_elapse_time_in_ns(core_freesync->dc->ctx, cur_tick, 0)/1000);
+			div_u64(dm_get_elapse_time_in_ns(core_freesync->dc->ctx, cur_tick, 0), 1000);
 
 	in_out_vrr->flip_interval.vsyncs_between_flip++;
 	in_out_vrr->flip_interval.v_update_timestamp_in_us = cur_timestamp_in_us;
-- 
2.32.0



More information about the amd-gfx mailing list