V4L/DVB (11877): lgdt3305: fix 64bit division in function lgdt3305_set_if

Signed-off-by: Michael Krufky <kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Michael Krufky 2009-05-28 13:50:36 -03:00 committed by Mauro Carvalho Chehab
parent a5beb7b323
commit 511da45734
1 changed files with 3 additions and 14 deletions

View File

@ -19,6 +19,7 @@
* *
*/ */
#include <asm/div64.h>
#include <linux/dvb/frontend.h> #include <linux/dvb/frontend.h>
#include "dvb_math.h" #include "dvb_math.h"
#include "lgdt3305.h" #include "lgdt3305.h"
@ -496,27 +497,15 @@ static int lgdt3305_set_if(struct lgdt3305_state *state,
nco = if_freq_khz / 10; nco = if_freq_khz / 10;
#define LGDT3305_64BIT_DIVISION_ENABLED 0
/* FIXME: 64bit division disabled to avoid linking error:
* WARNING: "__udivdi3" [lgdt3305.ko] undefined!
*/
switch (param->u.vsb.modulation) { switch (param->u.vsb.modulation) {
case VSB_8: case VSB_8:
#if LGDT3305_64BIT_DIVISION_ENABLED
nco <<= 24; nco <<= 24;
nco /= 625; do_div(nco, 625);
#else
nco *= ((1 << 24) / 625);
#endif
break; break;
case QAM_64: case QAM_64:
case QAM_256: case QAM_256:
#if LGDT3305_64BIT_DIVISION_ENABLED
nco <<= 28; nco <<= 28;
nco /= 625; do_div(nco, 625);
#else
nco *= ((1 << 28) / 625);
#endif
break; break;
default: default:
return -EINVAL; return -EINVAL;