[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250306-synopsys-hdmirx-fix-64-div-v1-1-dd5ff38bba5e@kernel.org>
Date: Thu, 06 Mar 2025 22:45:16 +0100
From: Nathan Chancellor <nathan@...nel.org>
To: Shreeya Patel <shreeya.patel@...labora.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Dmitry Osipenko <dmitry.osipenko@...labora.com>,
Hans Verkuil <hverkuil@...all.nl>
Cc: linux-media@...r.kernel.org, kernel@...labora.com,
linux-kernel@...r.kernel.org, Nathan Chancellor <nathan@...nel.org>
Subject: [PATCH] media: platform: synopsys: hdmirx: Fix 64-bit division for
32-bit targets
The build fails for 32-bit targets with:
arm-linux-gnueabi-ld: drivers/media/platform/synopsys/hdmirx/snps_hdmirx.o: in function `hdmirx_get_timings':
snps_hdmirx.c:(.text.hdmirx_get_timings+0x46c): undefined reference to `__aeabi_uldivmod'
bt->pixelclock is __u64, which causes the compiler to emit a libcall for
64-bit division. Use the optimized kernel helper, div_u64(), to resolve
this.
Fixes: 7b59b132ad43 ("media: platform: synopsys: Add support for HDMI input driver")
Signed-off-by: Nathan Chancellor <nathan@...nel.org>
---
drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
index 4d42da7255f3..e4cdd8b5745d 100644
--- a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
+++ b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
@@ -17,6 +17,7 @@
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/mfd/syscon.h>
+#include <linux/math64.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_platform.h>
@@ -291,7 +292,7 @@ static void hdmirx_get_timings(struct snps_hdmirx_dev *hdmirx_dev,
hfp = htotal - hact - hs - hbp;
vfp = vtotal - vact - vs - vbp;
- fps = (bt->pixelclock + (htotal * vtotal) / 2) / (htotal * vtotal);
+ fps = div_u64(bt->pixelclock + (htotal * vtotal) / 2, htotal * vtotal);
bt->width = hact;
bt->height = vact;
bt->hfrontporch = hfp;
---
base-commit: 143d75583f2427f3a97dba62413c4f0604867ebf
change-id: 20250306-synopsys-hdmirx-fix-64-div-c014c102bf48
Best regards,
--
Nathan Chancellor <nathan@...nel.org>
Powered by blists - more mailing lists