vserver 2.0 rc7
[linux-2.6.git] / drivers / media / dvb / frontends / mt312.c
index a5dcc87..e455aec 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
     Driver for Zarlink VP310/MT312 Satellite Channel Decoder
 
     Copyright (C) 2003 Andreas Oberritter <obi@linuxtv.org>
 
 
 struct mt312_state {
-
        struct i2c_adapter* i2c;
-
        struct dvb_frontend_ops ops;
-
        /* configuration settings */
        const struct mt312_config* config;
-
        struct dvb_frontend frontend;
 
        u8 id;
@@ -128,7 +124,7 @@ static int mt312_write(struct mt312_state* state, const enum mt312_reg_addr reg,
 }
 
 static inline int mt312_readreg(struct mt312_state* state,
-                               const enum mt312_reg_addr reg, u8 * val)
+                               const enum mt312_reg_addr reg, u8 *val)
 {
        return mt312_read(state, reg, val, 1);
 }
@@ -181,7 +177,7 @@ static int mt312_get_symbol_rate(struct mt312_state* state, u32 *sr)
                        return ret;
 
                if ((ret = mt312_read(state, MONITOR_H, buf, sizeof(buf))) < 0)
-               return ret;
+                       return ret;
 
                monitor = (buf[0] << 8) | buf[1];
 
@@ -206,7 +202,7 @@ static int mt312_get_symbol_rate(struct mt312_state* state, u32 *sr)
                dprintk(KERN_DEBUG "*sr(manual) = %lu\n",
                       (((MT312_PLL_CLK * 8192) / (sym_rat_op + 8192)) *
                        2) - dec_ratio);
-}
+       }
 
        return 0;
 }
@@ -226,25 +222,11 @@ static int mt312_get_code_rate(struct mt312_state* state, fe_code_rate_t *cr)
        *cr = fec_tab[(fec_status >> 4) & 0x07];
 
        return 0;
-       }
-
-
-
-
-
-
-
-
-       
-
-
-
-
-
+}
 
 static int mt312_initfe(struct dvb_frontend* fe)
 {
-       struct mt312_state *state = (struct mt312_state*) fe->demodulator_priv;
+       struct mt312_state *state = fe->demodulator_priv;
        int ret;
        u8 buf[2];
 
@@ -305,7 +287,7 @@ static int mt312_initfe(struct dvb_frontend* fe)
 static int mt312_send_master_cmd(struct dvb_frontend* fe,
                                 struct dvb_diseqc_master_cmd *c)
 {
-       struct mt312_state *state = (struct mt312_state*) fe->demodulator_priv;
+       struct mt312_state *state = fe->demodulator_priv;
        int ret;
        u8 diseqc_mode;
 
@@ -336,7 +318,7 @@ static int mt312_send_master_cmd(struct dvb_frontend* fe,
 
 static int mt312_send_burst(struct dvb_frontend* fe, const fe_sec_mini_cmd_t c)
 {
-       struct mt312_state *state = (struct mt312_state*) fe->demodulator_priv;
+       struct mt312_state *state = fe->demodulator_priv;
        const u8 mini_tab[2] = { 0x02, 0x03 };
 
        int ret;
@@ -358,7 +340,7 @@ static int mt312_send_burst(struct dvb_frontend* fe, const fe_sec_mini_cmd_t c)
 
 static int mt312_set_tone(struct dvb_frontend* fe, const fe_sec_tone_mode_t t)
 {
-       struct mt312_state *state = (struct mt312_state*) fe->demodulator_priv;
+       struct mt312_state *state = fe->demodulator_priv;
        const u8 tone_tab[2] = { 0x01, 0x00 };
 
        int ret;
@@ -380,7 +362,7 @@ static int mt312_set_tone(struct dvb_frontend* fe, const fe_sec_tone_mode_t t)
 
 static int mt312_set_voltage(struct dvb_frontend* fe, const fe_sec_voltage_t v)
 {
-       struct mt312_state *state = (struct mt312_state*) fe->demodulator_priv;
+       struct mt312_state *state = fe->demodulator_priv;
        const u8 volt_tab[3] = { 0x00, 0x40, 0x00 };
 
        if (v > SEC_VOLTAGE_OFF)
@@ -391,7 +373,7 @@ static int mt312_set_voltage(struct dvb_frontend* fe, const fe_sec_voltage_t v)
 
 static int mt312_read_status(struct dvb_frontend* fe, fe_status_t *s)
 {
-       struct mt312_state *state = (struct mt312_state*) fe->demodulator_priv;
+       struct mt312_state *state = fe->demodulator_priv;
        int ret;
        u8 status[3];
 
@@ -418,7 +400,7 @@ static int mt312_read_status(struct dvb_frontend* fe, fe_status_t *s)
 
 static int mt312_read_ber(struct dvb_frontend* fe, u32 *ber)
 {
-       struct mt312_state *state = (struct mt312_state*) fe->demodulator_priv;
+       struct mt312_state *state = fe->demodulator_priv;
        int ret;
        u8 buf[3];
 
@@ -432,7 +414,7 @@ static int mt312_read_ber(struct dvb_frontend* fe, u32 *ber)
 
 static int mt312_read_signal_strength(struct dvb_frontend* fe, u16 *signal_strength)
 {
-       struct mt312_state *state = (struct mt312_state*) fe->demodulator_priv;
+       struct mt312_state *state = fe->demodulator_priv;
        int ret;
        u8 buf[3];
        u16 agc;
@@ -453,7 +435,7 @@ static int mt312_read_signal_strength(struct dvb_frontend* fe, u16 *signal_stren
 
 static int mt312_read_snr(struct dvb_frontend* fe, u16 *snr)
 {
-       struct mt312_state *state = (struct mt312_state*) fe->demodulator_priv;
+       struct mt312_state *state = fe->demodulator_priv;
        int ret;
        u8 buf[2];
 
@@ -467,7 +449,7 @@ static int mt312_read_snr(struct dvb_frontend* fe, u16 *snr)
 
 static int mt312_read_ucblocks(struct dvb_frontend* fe, u32 *ubc)
 {
-       struct mt312_state *state = (struct mt312_state*) fe->demodulator_priv;
+       struct mt312_state *state = fe->demodulator_priv;
        int ret;
        u8 buf[2];
 
@@ -482,7 +464,7 @@ static int mt312_read_ucblocks(struct dvb_frontend* fe, u32 *ubc)
 static int mt312_set_frontend(struct dvb_frontend* fe,
                              struct dvb_frontend_parameters *p)
 {
-       struct mt312_state *state = (struct mt312_state*) fe->demodulator_priv;
+       struct mt312_state *state = fe->demodulator_priv;
        int ret;
        u8 buf[5], config_val;
        u16 sr;
@@ -525,7 +507,7 @@ static int mt312_set_frontend(struct dvb_frontend* fe,
                                state->frequency = 90;
                                if ((ret = mt312_initfe(fe)) < 0)
                                        return ret;
-               }
+                       }
                }
                else
                {
@@ -533,7 +515,7 @@ static int mt312_set_frontend(struct dvb_frontend* fe,
                                state->frequency = 60;
                                if ((ret = mt312_initfe(fe)) < 0)
                                        return ret;
-               }
+                       }
                }
                break;
 
@@ -578,7 +560,7 @@ static int mt312_set_frontend(struct dvb_frontend* fe,
 static int mt312_get_frontend(struct dvb_frontend* fe,
                              struct dvb_frontend_parameters *p)
 {
-       struct mt312_state *state = (struct mt312_state*) fe->demodulator_priv;
+       struct mt312_state *state = fe->demodulator_priv;
        int ret;
 
        if ((ret = mt312_get_inversion(state, &p->inversion)) < 0)
@@ -595,7 +577,7 @@ static int mt312_get_frontend(struct dvb_frontend* fe,
 
 static int mt312_sleep(struct dvb_frontend* fe)
 {
-       struct mt312_state *state = (struct mt312_state*) fe->demodulator_priv;
+       struct mt312_state *state = fe->demodulator_priv;
        int ret;
        u8 config;
 
@@ -614,16 +596,16 @@ static int mt312_sleep(struct dvb_frontend* fe)
 }
 
 static int mt312_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fesettings)
-       {
-               fesettings->min_delay_ms = 50;
-               fesettings->step_size = 0;
-               fesettings->max_drift = 0;
-               return 0;
-       }           
+{
+       fesettings->min_delay_ms = 50;
+       fesettings->step_size = 0;
+       fesettings->max_drift = 0;
+       return 0;
+}
 
 static void mt312_release(struct dvb_frontend* fe)
 {
-       struct mt312_state* state = (struct mt312_state*) fe->demodulator_priv;
+       struct mt312_state* state = fe->demodulator_priv;
        kfree(state);
 }
 
@@ -635,7 +617,7 @@ struct dvb_frontend* vp310_attach(const struct mt312_config* config,
        struct mt312_state* state = NULL;
 
        /* allocate memory for the internal state */
-       state = (struct mt312_state*) kmalloc(sizeof(struct mt312_state), GFP_KERNEL);
+       state = kmalloc(sizeof(struct mt312_state), GFP_KERNEL);
        if (state == NULL)
                goto error;
 
@@ -653,14 +635,13 @@ struct dvb_frontend* vp310_attach(const struct mt312_config* config,
        }
 
        /* create dvb_frontend */
-               state->frequency = 90;
+       state->frequency = 90;
        state->frontend.ops = &state->ops;
        state->frontend.demodulator_priv = state;
        return &state->frontend;
 
 error:
-       if (state)
-               kfree(state);
+       kfree(state);
        return NULL;
 }
 
@@ -670,7 +651,7 @@ struct dvb_frontend* mt312_attach(const struct mt312_config* config,
        struct mt312_state* state = NULL;
 
        /* allocate memory for the internal state */
-       state = (struct mt312_state*) kmalloc(sizeof(struct mt312_state), GFP_KERNEL);
+       state = kmalloc(sizeof(struct mt312_state), GFP_KERNEL);
        if (state == NULL)
                goto error;
 
@@ -685,7 +666,7 @@ struct dvb_frontend* mt312_attach(const struct mt312_config* config,
                goto error;
        if (state->id != ID_MT312) {
                goto error;
-}
+       }
 
        /* create dvb_frontend */
        state->frequency = 60;
@@ -716,7 +697,7 @@ static struct dvb_frontend_ops vp310_mt312_ops = {
                    FE_CAN_RECOVER
        },
 
-       .release = mt312_release,
+       .release = mt312_release,
 
        .init = mt312_initfe,
        .sleep = mt312_sleep,