Skip to content

Commit fae8cab

Browse files
nathanchancehverkuil
authored andcommitted
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: 7b59b13 ("media: platform: synopsys: Add support for HDMI input driver") Signed-off-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
1 parent 143d755 commit fae8cab

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <linux/interrupt.h>
1818
#include <linux/irq.h>
1919
#include <linux/mfd/syscon.h>
20+
#include <linux/math64.h>
2021
#include <linux/module.h>
2122
#include <linux/of.h>
2223
#include <linux/of_platform.h>
@@ -291,7 +292,7 @@ static void hdmirx_get_timings(struct snps_hdmirx_dev *hdmirx_dev,
291292
hfp = htotal - hact - hs - hbp;
292293
vfp = vtotal - vact - vs - vbp;
293294

294-
fps = (bt->pixelclock + (htotal * vtotal) / 2) / (htotal * vtotal);
295+
fps = div_u64(bt->pixelclock + (htotal * vtotal) / 2, htotal * vtotal);
295296
bt->width = hact;
296297
bt->height = vact;
297298
bt->hfrontporch = hfp;

0 commit comments

Comments
 (0)