Skip to contentSkip to conversation

drm/amd/display: Fix 64-bit division for 32-bit builds

PATCH In review [email protected] 2 participants 2 messages Dec 19, 2018 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd/display: Fix 64-bit division for 32-bit builds

From: Ken Chalmers <[email protected]>

[Why]
32-bit builds break when doing 64-bit division directly.

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

---
 drivers/gpu/drm/amd/display/dc/dce80/dce80_timing_generator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dce80/dce80_timing_generator.c +1 -1
index 5c629ae..8b5ce55 100644
@@ -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,
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1545251294-28136-1-git-send-email-sunpeng.li-5C7GfCeVMHo@public.gmane.org

Reviewed-by Harry Wentland
#2 lore raw
Quoted 11 lines · On 2018-12-19 3:28 p.m., [email protected] wrote:

From: Ken Chalmers <[email protected]>

[Why]
32-bit builds break when doing 64-bit division directly.

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

Harry

Quoted 10 lines
---
 drivers/gpu/drm/amd/display/dc/dce80/dce80_timing_generator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dce80/dce80_timing_generator.c +0 -0
index 5c629ae..8b5ce55 100644

drivers/gpu/drm/amd/display/dc/dce80/dce80_timing_generator.c static void program_pix_dur(struct timing_generator *tg, uint32_t pix_clk_100hz) · line 100

Quoted 8 lines
drivers/gpu/drm/amd/display/dc/dce80/dce80_timing_generator.c +1 -1
@@ -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,

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx