linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] media: venus: fix build on 32bit environments
@ 2019-10-08 10:47 Mauro Carvalho Chehab
  2019-10-08 15:23 ` Stanimir Varbanov
  0 siblings, 1 reply; 2+ messages in thread
From: Mauro Carvalho Chehab @ 2019-10-08 10:47 UTC (permalink / raw)
  To: Linux Media Mailing List
  Cc: Mauro Carvalho Chehab, Mauro Carvalho Chehab, Stanimir Varbanov,
	Andy Gross, linux-arm-msm

As reported by jenkins@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.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
---
 drivers/media/platform/qcom/venus/helpers.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c
index 5ea5d90f8e5f..a172f1ac0b35 100644
--- a/drivers/media/platform/qcom/venus/helpers.c
+++ b/drivers/media/platform/qcom/venus/helpers.c
@@ -520,10 +520,11 @@ static unsigned long calculate_inst_freq(struct venus_inst *inst,
 					 unsigned long filled_len)
 {
 	unsigned long vpp_freq = 0, vsp_freq = 0;
-	u64 fps = inst->fps;
+	u32 fps = (u32)inst->fps;
 	u32 mbs_per_sec;
 
-	mbs_per_sec = load_per_instance(inst) / inst->fps;
+	mbs_per_sec = load_per_instance(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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] media: venus: fix build on 32bit environments
  2019-10-08 10:47 [PATCH v2] media: venus: fix build on 32bit environments Mauro Carvalho Chehab
@ 2019-10-08 15:23 ` Stanimir Varbanov
  0 siblings, 0 replies; 2+ messages in thread
From: Stanimir Varbanov @ 2019-10-08 15:23 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Linux Media Mailing List
  Cc: Mauro Carvalho Chehab, Stanimir Varbanov, Andy Gross, linux-arm-msm

Mauro, thanks for the fix!

On 10/8/19 1:47 PM, Mauro Carvalho Chehab wrote:
> As reported by jenkins@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.

Please drop this line, it is not valid for v2.

> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
> ---
>  drivers/media/platform/qcom/venus/helpers.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

Reviewed-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>

> 
> diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c
> index 5ea5d90f8e5f..a172f1ac0b35 100644
> --- a/drivers/media/platform/qcom/venus/helpers.c
> +++ b/drivers/media/platform/qcom/venus/helpers.c
> @@ -520,10 +520,11 @@ static unsigned long calculate_inst_freq(struct venus_inst *inst,
>  					 unsigned long filled_len)
>  {
>  	unsigned long vpp_freq = 0, vsp_freq = 0;
> -	u64 fps = inst->fps;
> +	u32 fps = (u32)inst->fps;
>  	u32 mbs_per_sec;
>  
> -	mbs_per_sec = load_per_instance(inst) / inst->fps;
> +	mbs_per_sec = load_per_instance(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;
> 

-- 
regards,
Stan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-08 15:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-08 10:47 [PATCH v2] media: venus: fix build on 32bit environments Mauro Carvalho Chehab
2019-10-08 15:23 ` Stanimir Varbanov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).