Merge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6
[pandora-kernel.git] / drivers / media / dvb / frontends / dib3000mc.c
index 441de66..6c3be25 100644 (file)
@@ -26,6 +26,8 @@
 #include <linux/moduleparam.h>
 #include <linux/init.h>
 #include <linux/delay.h>
+#include <linux/string.h>
+#include <linux/slab.h>
 
 #include "dib3000-common.h"
 #include "dib3000mc_priv.h"
@@ -460,8 +462,9 @@ static int dib3000mc_set_frontend(struct dvb_frontend* fe,
        int search_state,auto_val;
        u16 val;
 
-       if (tuner && state->config.pll_set) { /* initial call from dvb */
-               state->config.pll_set(fe,fep);
+       if (tuner && fe->ops.tuner_ops.set_params) { /* initial call from dvb */
+               fe->ops.tuner_ops.set_params(fe, fep);
+               if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
 
                state->last_tuned_freq = fep->frequency;
        //      if (!scanboost) {
@@ -640,9 +643,6 @@ static int dib3000mc_fe_init(struct dvb_frontend* fe, int mobile_mode)
 
        set_or(DIB3000MC_REG_CLK_CFG_7,DIB3000MC_CLK_CFG_7_DIV_IN_OFF);
 
-       if (state->config.pll_init)
-               state->config.pll_init(fe);
-
        deb_info("init end\n");
        return 0;
 }
@@ -830,15 +830,13 @@ struct dvb_frontend* dib3000mc_attach(const struct dib3000_config* config,
        u16 devid;
 
        /* allocate memory for the internal state */
-       state = kmalloc(sizeof(struct dib3000_state), GFP_KERNEL);
+       state = kzalloc(sizeof(struct dib3000_state), GFP_KERNEL);
        if (state == NULL)
                goto error;
-       memset(state,0,sizeof(struct dib3000_state));
 
        /* setup the state */
        state->i2c = i2c;
        memcpy(&state->config,config,sizeof(struct dib3000_config));
-       memcpy(&state->ops, &dib3000mc_ops, sizeof(struct dvb_frontend_ops));
 
        /* check for the correct demod */
        if (rd(DIB3000_REG_MANUFACTOR_ID) != DIB3000_I2C_ID_DIBCOM)
@@ -858,7 +856,7 @@ struct dvb_frontend* dib3000mc_attach(const struct dib3000_config* config,
        }
 
        /* create dvb_frontend */
-       state->frontend.ops = &state->ops;
+       memcpy(&state->frontend.ops, &dib3000mc_ops, sizeof(struct dvb_frontend_ops));
        state->frontend.demodulator_priv = state;
 
        /* set the xfer operations */
@@ -875,6 +873,7 @@ error:
        kfree(state);
        return NULL;
 }
+EXPORT_SYMBOL(dib3000mc_attach);
 
 static struct dvb_frontend_ops dib3000mc_ops = {
 
@@ -913,5 +912,3 @@ static struct dvb_frontend_ops dib3000mc_ops = {
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE("GPL");
-
-EXPORT_SYMBOL(dib3000mc_attach);