]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/media/dvb/frontends/mt352.c
[WATCHDOG] Merge code clean-up's from Alan Cox.
[linux-2.6-omap-h63xx.git] / drivers / media / dvb / frontends / mt352.c
index 87e31ca7e1084e9d7916468eb9038e0dae6d71a5..beba5aa0db5000e17d520ef8e473953c8720662d 100644 (file)
@@ -32,7 +32,6 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/moduleparam.h>
 #include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/string.h>
@@ -96,7 +95,7 @@ static int mt352_read_register(struct mt352_state* state, u8 reg)
 
        if (ret != 2) {
                printk("%s: readreg error (reg=%d, ret==%i)\n",
-                      __FUNCTION__, reg, ret);
+                      __func__, reg, ret);
                return ret;
        }
 
@@ -136,7 +135,7 @@ static void mt352_calc_nominal_rate(struct mt352_state* state,
        value = 64 * bw * (1<<16) / (7 * 8);
        value = value * 1000 / adc_clock;
        dprintk("%s: bw %d, adc_clock %d => 0x%x\n",
-               __FUNCTION__, bw, adc_clock, value);
+               __func__, bw, adc_clock, value);
        buf[0] = msb(value);
        buf[1] = lsb(value);
 }
@@ -153,10 +152,16 @@ static void mt352_calc_input_freq(struct mt352_state* state,
        if (state->config.if2)
                if2 = state->config.if2;
 
-       ife = (2*adc_clock - if2);
+       if (adc_clock >= if2 * 2)
+               ife = if2;
+       else {
+               ife = adc_clock - (if2 % adc_clock);
+               if (ife > adc_clock / 2)
+                       ife = adc_clock - ife;
+       }
        value = -16374 * ife / adc_clock;
        dprintk("%s: if2 %d, ife %d, adc_clock %d => %d / 0x%x\n",
-               __FUNCTION__, if2, ife, adc_clock, value, value & 0x3fff);
+               __func__, if2, ife, adc_clock, value, value & 0x3fff);
        buf[0] = msb(value);
        buf[1] = lsb(value);
 }
@@ -516,7 +521,7 @@ static int mt352_init(struct dvb_frontend* fe)
 
        static u8 mt352_reset_attach [] = { RESET, 0xC0 };
 
-       dprintk("%s: hello\n",__FUNCTION__);
+       dprintk("%s: hello\n",__func__);
 
        if ((mt352_read_register(state, CLOCK_CTL) & 0x10) == 0 ||
            (mt352_read_register(state, CONFIG) & 0x20) == 0) {