From d933db51bba0b9f9419ac7046cbd6df20c10b960 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 8 Apr 2009 23:18:24 +0000 Subject: cx88-dsp: fixing 64bit math on 32bit kernels From: Miroslav Sustek Signed-off-by: Miroslav Sustek Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/cx88/cx88-dsp.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/cx88/cx88-dsp.c b/linux/drivers/media/video/cx88/cx88-dsp.c index 262bda9ec..4699055f2 100644 --- a/linux/drivers/media/video/cx88/cx88-dsp.c +++ b/linux/drivers/media/video/cx88/cx88-dsp.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "cx88.h" #include "cx88-reg.h" @@ -101,8 +102,8 @@ static u32 int_goertzel(s16 x[], u32 N, u32 freq) s32 coeff = 2*int_cos(freq); u32 i; - s64 tmp; - u32 remainder; + u64 tmp; + u32 divisor; for (i = 0; i < N; i++) { s32 s = x[i] + ((s64)coeff*s_prev/32768) - s_prev2; @@ -115,7 +116,10 @@ static u32 int_goertzel(s16 x[], u32 N, u32 freq) /* XXX: N must be low enough so that N*N fits in s32. * Else we need two divisions. */ - return (u32) div_s64_rem(tmp, N*N, &remainder); + divisor = N * N; + do_div(tmp, divisor); + + return (u32) tmp; } static u32 freq_magnitude(s16 x[], u32 N, u32 freq) -- cgit v1.2.3