@@ -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)