Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
[pandora-kernel.git] / drivers / media / dvb / frontends / l64781.c
index 1c7c912..3051b64 100644 (file)
@@ -23,7 +23,6 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/moduleparam.h>
 #include <linux/string.h>
 #include <linux/slab.h>
 #include "dvb_frontend.h"
 
 struct l64781_state {
        struct i2c_adapter* i2c;
-       struct dvb_frontend_ops ops;
        const struct l64781_config* config;
        struct dvb_frontend frontend;
 
        /* private demodulator data */
-       int first:1;
+       unsigned int first:1;
 };
 
 #define dprintk(args...) \
@@ -59,7 +57,7 @@ static int l64781_writereg (struct l64781_state* state, u8 reg, u8 data)
 
        if ((ret = i2c_transfer(state->i2c, &msg, 1)) != 1)
                dprintk ("%s: write_reg error (reg == %02x) = %02x!\n",
-                        __FUNCTION__, reg, ret);
+                        __func__, reg, ret);
 
        return (ret != 1) ? -1 : 0;
 }
@@ -141,7 +139,10 @@ static int apply_frontend_param (struct dvb_frontend* fe, struct dvb_frontend_pa
        u8 val0x06;
        int bw = p->bandwidth - BANDWIDTH_8_MHZ;
 
-       state->config->pll_set(fe, param);
+       if (fe->ops.tuner_ops.set_params) {
+               fe->ops.tuner_ops.set_params(fe, param);
+               if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
+       }
 
        if (param->inversion != INVERSION_ON &&
            param->inversion != INVERSION_OFF)
@@ -463,8 +464,6 @@ static int l64781_init(struct dvb_frontend* fe)
        /* Everything is two's complement, soft bit and CSI_OUT too */
        l64781_writereg (state, 0x1e, 0x09);
 
-       if (state->config->pll_init) state->config->pll_init(fe);
-
        /* delay a bit after first init attempt */
        if (state->first) {
                state->first = 0;
@@ -502,13 +501,12 @@ struct dvb_frontend* l64781_attach(const struct l64781_config* config,
                           { .addr = config->demod_address, .flags = I2C_M_RD, .buf = b1, .len = 1 } };
 
        /* allocate memory for the internal state */
-       state = kmalloc(sizeof(struct l64781_state), GFP_KERNEL);
+       state = kzalloc(sizeof(struct l64781_state), GFP_KERNEL);
        if (state == NULL) goto error;
 
        /* setup the state */
        state->config = config;
        state->i2c = i2c;
-       memcpy(&state->ops, &l64781_ops, sizeof(struct dvb_frontend_ops));
        state->first = 1;
 
        /**
@@ -554,7 +552,7 @@ struct dvb_frontend* l64781_attach(const struct l64781_config* config,
        }
 
        /* create dvb_frontend */
-       state->frontend.ops = &state->ops;
+       memcpy(&state->frontend.ops, &l64781_ops, sizeof(struct dvb_frontend_ops));
        state->frontend.demodulator_priv = state;
        return &state->frontend;