Re: cx88-dsp.c: missing __divdi3 on 32bit kernel
Commit Message
On Tue, 7 Apr 2009, Marton Balint wrote:
> On Mon, 6 Apr 2009, Miroslav Ĺ ustek wrote:
>
> > Well this patch should solve it.
> >
> > I don't know how many samples are processed so:
> > First patch is for situation when N*N fits in s32.
> > Second one uses two divisions, but doesn't have any abnormal restrictions for N.
>
> Both patches are fine, beacuse in the current implementation N is not
> bigger than 576. Thanks for fixing this problem.
It seems that an #include is missing to math64.h. Below is a patch that
adds the missing include.
Regards,
Marton
# HG changeset patch
# User Marton Balint <cus@fazekas.hu>
# Date 1239222228 -7200
# Node ID c07293f1b5e44a8614f8f84c6b4fc586a02e69eb
# Parent 202a1c7ec37968f35678980b5f3d9812e5961ef0
cx88: dsp: add missing include to math64.h
From: Marton Balint <cus@fazekas.hu>
This patch adds a missing include to math64.h and replaces div_s64_rem with
div_s64 since the remainder is not used anyway.
Priority: normal
Signed-off-by: Marton Balint <cus@fazekas.hu>
@@ -22,6 +22,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/jiffies.h>
+#include <linux/math64.h>
#include "cx88.h"
#include "cx88-reg.h"
@@ -100,9 +101,7 @@
s32 s_prev2 = 0;
s32 coeff = 2*int_cos(freq);
u32 i;
-
s64 tmp;
- u32 remainder;
for (i = 0; i < N; i++) {
s32 s = x[i] + ((s64)coeff*s_prev/32768) - s_prev2;
@@ -113,9 +112,8 @@
tmp = (s64)s_prev2*s_prev2 + (s64)s_prev*s_prev -
(s64)coeff*s_prev2*s_prev/32768;
- /* 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);
+ /* N is low enough so N*N fits in s32. */
+ return (u32) div_s64(tmp, N*N);
}
static u32 freq_magnitude(s16 x[], u32 N, u32 freq)