As reported by jenk...@linuxtv.org, the build with i386 fails
with:

        ld: drivers/media/platform/qcom/venus/helpers.o: in function 
`venus_helper_load_scale_clocks':
        (.text+0x1d77): undefined reference to `__udivdi3'
        ld: (.text+0x1dce): undefined reference to `__udivdi3'
        make: *** [Makefile:1094: vmlinux] Error 1

That's because it divides an u32 bit integer by a u64 one.

Fix it by explicitly callind do_div.

That's said, why fps is a 64 bits integer?

Signed-off-by: Mauro Carvalho Chehab <mchehab+sams...@kernel.org>
---
 drivers/media/platform/qcom/venus/helpers.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/qcom/venus/helpers.c 
b/drivers/media/platform/qcom/venus/helpers.c
index 5ea5d90f8e5f..09fa87e3c0a0 100644
--- a/drivers/media/platform/qcom/venus/helpers.c
+++ b/drivers/media/platform/qcom/venus/helpers.c
@@ -522,8 +522,14 @@ static unsigned long calculate_inst_freq(struct venus_inst 
*inst,
        unsigned long vpp_freq = 0, vsp_freq = 0;
        u64 fps = inst->fps;
        u32 mbs_per_sec;
+       u64 tmp;
+
+
+       tmp = load_per_instance(inst);
+       do_div(tmp, inst->fps);
+
+       mbs_per_sec = (u32)tmp;
 
-       mbs_per_sec = load_per_instance(inst) / inst->fps;
        vpp_freq = mbs_per_sec * inst->clk_data.codec_freq_data->vpp_freq;
        /* 21 / 20 is overhead factor */
        vpp_freq += vpp_freq / 20;
-- 
2.21.0

Reply via email to