Commit dea74869 authored by Patrick Boettcher's avatar Patrick Boettcher Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB (4028): Change dvb_frontend_ops to be a real field instead of a...

V4L/DVB (4028): Change dvb_frontend_ops to be a real field instead of a pointer field inside dvb_frontend

The dvb_frontend_ops is a pointer inside dvb_frontend. That's why every demod-driver
is having a field of dvb_frontend_ops in its private-state-struct and
using the reference for filling the pointer-field in dvb_frontend.
- It saves at least two lines of code per demod-driver,
- reduces object size (one less dereference per frontend_ops-access),
- be coherent with dvb_tuner_ops,
- makes it a little bit easier for newbies to understand how it works and
- avoids stupid mistakes because you would have to copy the dvb_frontend_ops
  always, before you could assign the static pointer directly, which was
  dangerous.
Signed-off-by: default avatarPatrick Boettcher <pb@linuxtv.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 332bed5f
...@@ -183,8 +183,8 @@ static int samsung_tbmu24112_tuner_set_params(struct dvb_frontend* fe, struct dv ...@@ -183,8 +183,8 @@ static int samsung_tbmu24112_tuner_set_params(struct dvb_frontend* fe, struct dv
if (params->frequency < 1500000) buf[3] |= 0x10; if (params->frequency < 1500000) buf[3] |= 0x10;
if (fe->ops->i2c_gate_ctrl) if (fe->ops.i2c_gate_ctrl)
fe->ops->i2c_gate_ctrl(fe, 1); fe->ops.i2c_gate_ctrl(fe, 1);
if (i2c_transfer(&fc->i2c_adap, &msg, 1) != 1) { if (i2c_transfer(&fc->i2c_adap, &msg, 1) != 1) {
return -EIO; return -EIO;
} }
...@@ -342,8 +342,8 @@ static int skystar23_samsung_tbdu18132_tuner_set_params(struct dvb_frontend* fe, ...@@ -342,8 +342,8 @@ static int skystar23_samsung_tbdu18132_tuner_set_params(struct dvb_frontend* fe,
if (params->frequency < 1550000) if (params->frequency < 1550000)
buf[3] |= 0x02; buf[3] |= 0x02;
if (fe->ops->i2c_gate_ctrl) if (fe->ops.i2c_gate_ctrl)
fe->ops->i2c_gate_ctrl(fe, 1); fe->ops.i2c_gate_ctrl(fe, 1);
if (i2c_transfer(&fc->i2c_adap, &msg, 1) != 1) if (i2c_transfer(&fc->i2c_adap, &msg, 1) != 1)
return -EIO; return -EIO;
return 0; return 0;
...@@ -389,8 +389,8 @@ int alps_tdee4_stv0297_tuner_set_params (struct dvb_frontend* fe, struct dvb_fro ...@@ -389,8 +389,8 @@ int alps_tdee4_stv0297_tuner_set_params (struct dvb_frontend* fe, struct dvb_fro
else if (fep->frequency <= 822000000) buf[3] = 0x08; else if (fep->frequency <= 822000000) buf[3] = 0x08;
else buf[3] = 0x88; else buf[3] = 0x88;
if (fe->ops->i2c_gate_ctrl) if (fe->ops.i2c_gate_ctrl)
fe->ops->i2c_gate_ctrl(fe, 1); fe->ops.i2c_gate_ctrl(fe, 1);
deb_tuner("tuner buffer for %d Hz: %x %x %x %x\n",fep->frequency, buf[0],buf[1],buf[2],buf[3]); deb_tuner("tuner buffer for %d Hz: %x %x %x %x\n",fep->frequency, buf[0],buf[1],buf[2],buf[3]);
ret = fc->i2c_request(fc,FC_WRITE,FC_I2C_PORT_TUNER,0x61,buf[0],&buf[1],3); ret = fc->i2c_request(fc,FC_WRITE,FC_I2C_PORT_TUNER,0x61,buf[0],&buf[1],3);
deb_tuner("tuner write returned: %d\n",ret); deb_tuner("tuner write returned: %d\n",ret);
...@@ -505,7 +505,7 @@ int flexcop_frontend_init(struct flexcop_device *fc) ...@@ -505,7 +505,7 @@ int flexcop_frontend_init(struct flexcop_device *fc)
/* try the sky v2.6 (stv0299/Samsung tbmu24112(sl1935)) */ /* try the sky v2.6 (stv0299/Samsung tbmu24112(sl1935)) */
if ((fc->fe = stv0299_attach(&samsung_tbmu24112_config, &fc->i2c_adap)) != NULL) { if ((fc->fe = stv0299_attach(&samsung_tbmu24112_config, &fc->i2c_adap)) != NULL) {
ops = fc->fe->ops; ops = &fc->fe->ops;
ops->tuner_ops.set_params = samsung_tbmu24112_tuner_set_params; ops->tuner_ops.set_params = samsung_tbmu24112_tuner_set_params;
...@@ -520,7 +520,7 @@ int flexcop_frontend_init(struct flexcop_device *fc) ...@@ -520,7 +520,7 @@ int flexcop_frontend_init(struct flexcop_device *fc)
/* try the air dvb-t (mt352/Samsung tdtc9251dh0(??)) */ /* try the air dvb-t (mt352/Samsung tdtc9251dh0(??)) */
if ((fc->fe = mt352_attach(&samsung_tdtc9251dh0_config, &fc->i2c_adap)) != NULL ) { if ((fc->fe = mt352_attach(&samsung_tdtc9251dh0_config, &fc->i2c_adap)) != NULL ) {
fc->dev_type = FC_AIR_DVB; fc->dev_type = FC_AIR_DVB;
fc->fe->ops->tuner_ops.calc_regs = samsung_tdtc9251dh0_calc_regs; fc->fe->ops.tuner_ops.calc_regs = samsung_tdtc9251dh0_calc_regs;
info("found the mt352 at i2c address: 0x%02x",samsung_tdtc9251dh0_config.demod_address); info("found the mt352 at i2c address: 0x%02x",samsung_tdtc9251dh0_config.demod_address);
} else } else
/* try the air atsc 2nd generation (nxt2002) */ /* try the air atsc 2nd generation (nxt2002) */
...@@ -532,7 +532,7 @@ int flexcop_frontend_init(struct flexcop_device *fc) ...@@ -532,7 +532,7 @@ int flexcop_frontend_init(struct flexcop_device *fc)
/* try the air atsc 3nd generation (lgdt3303) */ /* try the air atsc 3nd generation (lgdt3303) */
if ((fc->fe = lgdt330x_attach(&air2pc_atsc_hd5000_config, &fc->i2c_adap)) != NULL) { if ((fc->fe = lgdt330x_attach(&air2pc_atsc_hd5000_config, &fc->i2c_adap)) != NULL) {
fc->dev_type = FC_AIR_ATSC3; fc->dev_type = FC_AIR_ATSC3;
fc->fe->ops->tuner_ops.set_params = lgdt3303_tuner_set_params; fc->fe->ops.tuner_ops.set_params = lgdt3303_tuner_set_params;
info("found the lgdt3303 at i2c address: 0x%02x",air2pc_atsc_hd5000_config.demod_address); info("found the lgdt3303 at i2c address: 0x%02x",air2pc_atsc_hd5000_config.demod_address);
} else } else
/* try the air atsc 1nd generation (bcm3510)/panasonic ct10s */ /* try the air atsc 1nd generation (bcm3510)/panasonic ct10s */
...@@ -543,12 +543,12 @@ int flexcop_frontend_init(struct flexcop_device *fc) ...@@ -543,12 +543,12 @@ int flexcop_frontend_init(struct flexcop_device *fc)
/* try the cable dvb (stv0297) */ /* try the cable dvb (stv0297) */
if ((fc->fe = stv0297_attach(&alps_tdee4_stv0297_config, &fc->i2c_adap)) != NULL) { if ((fc->fe = stv0297_attach(&alps_tdee4_stv0297_config, &fc->i2c_adap)) != NULL) {
fc->dev_type = FC_CABLE; fc->dev_type = FC_CABLE;
fc->fe->ops->tuner_ops.set_params = alps_tdee4_stv0297_tuner_set_params; fc->fe->ops.tuner_ops.set_params = alps_tdee4_stv0297_tuner_set_params;
info("found the stv0297 at i2c address: 0x%02x",alps_tdee4_stv0297_config.demod_address); info("found the stv0297 at i2c address: 0x%02x",alps_tdee4_stv0297_config.demod_address);
} else } else
/* try the sky v2.3 (vp310/Samsung tbdu18132(tsa5059)) */ /* try the sky v2.3 (vp310/Samsung tbdu18132(tsa5059)) */
if ((fc->fe = vp310_mt312_attach(&skystar23_samsung_tbdu18132_config, &fc->i2c_adap)) != NULL) { if ((fc->fe = vp310_mt312_attach(&skystar23_samsung_tbdu18132_config, &fc->i2c_adap)) != NULL) {
ops = fc->fe->ops; ops = &fc->fe->ops;
ops->tuner_ops.set_params = skystar23_samsung_tbdu18132_tuner_set_params; ops->tuner_ops.set_params = skystar23_samsung_tbdu18132_tuner_set_params;
...@@ -570,7 +570,7 @@ int flexcop_frontend_init(struct flexcop_device *fc) ...@@ -570,7 +570,7 @@ int flexcop_frontend_init(struct flexcop_device *fc)
} else { } else {
if (dvb_register_frontend(&fc->dvb_adapter, fc->fe)) { if (dvb_register_frontend(&fc->dvb_adapter, fc->fe)) {
err("frontend registration failed!"); err("frontend registration failed!");
ops = fc->fe->ops; ops = &fc->fe->ops;
if (ops->release != NULL) if (ops->release != NULL)
ops->release(fc->fe); ops->release(fc->fe);
fc->fe = NULL; fc->fe = NULL;
......
...@@ -1417,24 +1417,22 @@ struct dst_state *dst_attach(struct dst_state *state, struct dvb_adapter *dvb_ad ...@@ -1417,24 +1417,22 @@ struct dst_state *dst_attach(struct dst_state *state, struct dvb_adapter *dvb_ad
return NULL; return NULL;
} }
/* determine settings based on type */ /* determine settings based on type */
/* create dvb_frontend */
switch (state->dst_type) { switch (state->dst_type) {
case DST_TYPE_IS_TERR: case DST_TYPE_IS_TERR:
memcpy(&state->ops, &dst_dvbt_ops, sizeof(struct dvb_frontend_ops)); memcpy(&state->frontend.ops, &dst_dvbt_ops, sizeof(struct dvb_frontend_ops));
break; break;
case DST_TYPE_IS_CABLE: case DST_TYPE_IS_CABLE:
memcpy(&state->ops, &dst_dvbc_ops, sizeof(struct dvb_frontend_ops)); memcpy(&state->frontend.ops, &dst_dvbc_ops, sizeof(struct dvb_frontend_ops));
break; break;
case DST_TYPE_IS_SAT: case DST_TYPE_IS_SAT:
memcpy(&state->ops, &dst_dvbs_ops, sizeof(struct dvb_frontend_ops)); memcpy(&state->frontend.ops, &dst_dvbs_ops, sizeof(struct dvb_frontend_ops));
break; break;
default: default:
dprintk(verbose, DST_ERROR, 1, "unknown DST type. please report to the LinuxTV.org DVB mailinglist."); dprintk(verbose, DST_ERROR, 1, "unknown DST type. please report to the LinuxTV.org DVB mailinglist.");
kfree(state); kfree(state);
return NULL; return NULL;
} }
/* create dvb_frontend */
state->frontend.ops = &state->ops;
state->frontend.demodulator_priv = state; state->frontend.demodulator_priv = state;
return state; /* Manu (DST is a card not a frontend) */ return state; /* Manu (DST is a card not a frontend) */
......
...@@ -84,8 +84,6 @@ struct dst_state { ...@@ -84,8 +84,6 @@ struct dst_state {
struct bt878* bt; struct bt878* bt;
struct dvb_frontend_ops ops;
/* configuration settings */ /* configuration settings */
const struct dst_config* config; const struct dst_config* config;
......
...@@ -300,8 +300,8 @@ static int microtune_mt7202dtf_tuner_set_params(struct dvb_frontend* fe, struct ...@@ -300,8 +300,8 @@ static int microtune_mt7202dtf_tuner_set_params(struct dvb_frontend* fe, struct
data[2] = ((div >> 10) & 0x60) | cfg; data[2] = ((div >> 10) & 0x60) | cfg;
data[3] = (cpump << 6) | band_select; data[3] = (cpump << 6) | band_select;
if (fe->ops->i2c_gate_ctrl) if (fe->ops.i2c_gate_ctrl)
fe->ops->i2c_gate_ctrl(fe, 1); fe->ops.i2c_gate_ctrl(fe, 1);
i2c_transfer(card->i2c_adapter, &msg, 1); i2c_transfer(card->i2c_adapter, &msg, 1);
return (div * 166666 - 36000000); return (div * 166666 - 36000000);
} }
...@@ -483,8 +483,8 @@ static int vp3021_alps_tded4_tuner_set_params(struct dvb_frontend* fe, struct dv ...@@ -483,8 +483,8 @@ static int vp3021_alps_tded4_tuner_set_params(struct dvb_frontend* fe, struct dv
else else
return -EINVAL; return -EINVAL;
if (fe->ops->i2c_gate_ctrl) if (fe->ops.i2c_gate_ctrl)
fe->ops->i2c_gate_ctrl(fe, 1); fe->ops.i2c_gate_ctrl(fe, 1);
i2c_transfer(card->i2c_adapter, &msg, 1); i2c_transfer(card->i2c_adapter, &msg, 1);
return 0; return 0;
} }
...@@ -607,9 +607,9 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type) ...@@ -607,9 +607,9 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
card->i2c_adapter); card->i2c_adapter);
if (card->fe != NULL) { if (card->fe != NULL) {
card->fe->ops->tuner_ops.calc_regs = thomson_dtt7579_tuner_calc_regs; card->fe->ops.tuner_ops.calc_regs = thomson_dtt7579_tuner_calc_regs;
card->fe->ops->info.frequency_min = 174000000; card->fe->ops.info.frequency_min = 174000000;
card->fe->ops->info.frequency_max = 862000000; card->fe->ops.info.frequency_max = 862000000;
} }
break; break;
...@@ -617,7 +617,7 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type) ...@@ -617,7 +617,7 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
lgdt330x_reset(card); lgdt330x_reset(card);
card->fe = lgdt330x_attach(&tdvs_tua6034_config, card->i2c_adapter); card->fe = lgdt330x_attach(&tdvs_tua6034_config, card->i2c_adapter);
if (card->fe != NULL) { if (card->fe != NULL) {
card->fe->ops->tuner_ops.set_params = tdvs_tua6034_tuner_set_params; card->fe->ops.tuner_ops.set_params = tdvs_tua6034_tuner_set_params;
dprintk ("dvb_bt8xx: lgdt330x detected\n"); dprintk ("dvb_bt8xx: lgdt330x detected\n");
} }
break; break;
...@@ -632,7 +632,7 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type) ...@@ -632,7 +632,7 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
digitv_alps_tded4_reset(card); digitv_alps_tded4_reset(card);
card->fe = nxt6000_attach(&vp3021_alps_tded4_config, card->i2c_adapter); card->fe = nxt6000_attach(&vp3021_alps_tded4_config, card->i2c_adapter);
if (card->fe != NULL) { if (card->fe != NULL) {
card->fe->ops->tuner_ops.set_params = vp3021_alps_tded4_tuner_set_params; card->fe->ops.tuner_ops.set_params = vp3021_alps_tded4_tuner_set_params;
dprintk ("dvb_bt8xx: an nxt6000 was detected on your digitv card\n"); dprintk ("dvb_bt8xx: an nxt6000 was detected on your digitv card\n");
break; break;
} }
...@@ -642,7 +642,7 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type) ...@@ -642,7 +642,7 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
card->fe = mt352_attach(&digitv_alps_tded4_config, card->i2c_adapter); card->fe = mt352_attach(&digitv_alps_tded4_config, card->i2c_adapter);
if (card->fe != NULL) { if (card->fe != NULL) {
card->fe->ops->tuner_ops.calc_regs = digitv_alps_tded4_tuner_calc_regs; card->fe->ops.tuner_ops.calc_regs = digitv_alps_tded4_tuner_calc_regs;
dprintk ("dvb_bt8xx: an mt352 was detected on your digitv card\n"); dprintk ("dvb_bt8xx: an mt352 was detected on your digitv card\n");
} }
break; break;
...@@ -650,16 +650,16 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type) ...@@ -650,16 +650,16 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
case BTTV_BOARD_AVDVBT_761: case BTTV_BOARD_AVDVBT_761:
card->fe = sp887x_attach(&microtune_mt7202dtf_config, card->i2c_adapter); card->fe = sp887x_attach(&microtune_mt7202dtf_config, card->i2c_adapter);
if (card->fe) { if (card->fe) {
card->fe->ops->tuner_ops.set_params = microtune_mt7202dtf_tuner_set_params; card->fe->ops.tuner_ops.set_params = microtune_mt7202dtf_tuner_set_params;
} }
break; break;
case BTTV_BOARD_AVDVBT_771: case BTTV_BOARD_AVDVBT_771:
card->fe = mt352_attach(&advbt771_samsung_tdtc9251dh0_config, card->i2c_adapter); card->fe = mt352_attach(&advbt771_samsung_tdtc9251dh0_config, card->i2c_adapter);
if (card->fe != NULL) { if (card->fe != NULL) {
card->fe->ops->tuner_ops.calc_regs = advbt771_samsung_tdtc9251dh0_tuner_calc_regs; card->fe->ops.tuner_ops.calc_regs = advbt771_samsung_tdtc9251dh0_tuner_calc_regs;
card->fe->ops->info.frequency_min = 174000000; card->fe->ops.info.frequency_min = 174000000;
card->fe->ops->info.frequency_max = 862000000; card->fe->ops.info.frequency_max = 862000000;
} }
break; break;
...@@ -687,9 +687,9 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type) ...@@ -687,9 +687,9 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
case BTTV_BOARD_PINNACLESAT: case BTTV_BOARD_PINNACLESAT:
card->fe = cx24110_attach(&pctvsat_config, card->i2c_adapter); card->fe = cx24110_attach(&pctvsat_config, card->i2c_adapter);
if (card->fe) { if (card->fe) {
card->fe->ops->tuner_ops.init = pinnsat_tuner_init; card->fe->ops.tuner_ops.init = pinnsat_tuner_init;
card->fe->ops->tuner_ops.sleep = pinnsat_tuner_sleep; card->fe->ops.tuner_ops.sleep = pinnsat_tuner_sleep;
card->fe->ops->tuner_ops.set_params = cx24108_tuner_set_params; card->fe->ops.tuner_ops.set_params = cx24108_tuner_set_params;
} }
break; break;
...@@ -707,8 +707,8 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type) ...@@ -707,8 +707,8 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
else else
if (dvb_register_frontend(&card->dvb_adapter, card->fe)) { if (dvb_register_frontend(&card->dvb_adapter, card->fe)) {
printk("dvb-bt8xx: Frontend registration failed!\n"); printk("dvb-bt8xx: Frontend registration failed!\n");
if (card->fe->ops->release) if (card->fe->ops.release)
card->fe->ops->release(card->fe); card->fe->ops.release(card->fe);
card->fe = NULL; card->fe = NULL;
} }
} }
......
...@@ -151,8 +151,8 @@ static void dvb_frontend_add_event(struct dvb_frontend *fe, fe_status_t status) ...@@ -151,8 +151,8 @@ static void dvb_frontend_add_event(struct dvb_frontend *fe, fe_status_t status)
sizeof (struct dvb_frontend_parameters)); sizeof (struct dvb_frontend_parameters));
if (status & FE_HAS_LOCK) if (status & FE_HAS_LOCK)
if (fe->ops->get_frontend) if (fe->ops.get_frontend)
fe->ops->get_frontend(fe, &e->parameters); fe->ops.get_frontend(fe, &e->parameters);
events->eventw = wp; events->eventw = wp;
...@@ -211,14 +211,14 @@ static void dvb_frontend_init(struct dvb_frontend *fe) ...@@ -211,14 +211,14 @@ static void dvb_frontend_init(struct dvb_frontend *fe)
{ {
dprintk ("DVB: initialising frontend %i (%s)...\n", dprintk ("DVB: initialising frontend %i (%s)...\n",
fe->dvb->num, fe->dvb->num,
fe->ops->info.name); fe->ops.info.name);
if (fe->ops->init) if (fe->ops.init)
fe->ops->init(fe); fe->ops.init(fe);
if (fe->ops->tuner_ops.init) { if (fe->ops.tuner_ops.init) {
fe->ops->tuner_ops.init(fe); fe->ops.tuner_ops.init(fe);
if (fe->ops->i2c_gate_ctrl) if (fe->ops.i2c_gate_ctrl)
fe->ops->i2c_gate_ctrl(fe, 0); fe->ops.i2c_gate_ctrl(fe, 0);
} }
} }
...@@ -264,7 +264,7 @@ static int dvb_frontend_swzigzag_autotune(struct dvb_frontend *fe, int check_wra ...@@ -264,7 +264,7 @@ static int dvb_frontend_swzigzag_autotune(struct dvb_frontend *fe, int check_wra
u32 original_frequency = fepriv->parameters.frequency; u32 original_frequency = fepriv->parameters.frequency;
/* are we using autoinversion? */ /* are we using autoinversion? */
autoinversion = ((!(fe->ops->info.caps & FE_CAN_INVERSION_AUTO)) && autoinversion = ((!(fe->ops.info.caps & FE_CAN_INVERSION_AUTO)) &&
(fepriv->parameters.inversion == INVERSION_AUTO)); (fepriv->parameters.inversion == INVERSION_AUTO));
/* setup parameters correctly */ /* setup parameters correctly */
...@@ -334,8 +334,8 @@ static int dvb_frontend_swzigzag_autotune(struct dvb_frontend *fe, int check_wra ...@@ -334,8 +334,8 @@ static int dvb_frontend_swzigzag_autotune(struct dvb_frontend *fe, int check_wra
fepriv->parameters.frequency += fepriv->lnb_drift; fepriv->parameters.frequency += fepriv->lnb_drift;
if (autoinversion) if (autoinversion)
fepriv->parameters.inversion = fepriv->inversion; fepriv->parameters.inversion = fepriv->inversion;
if (fe->ops->set_frontend) if (fe->ops.set_frontend)
fe->ops->set_frontend(fe, &fepriv->parameters); fe->ops.set_frontend(fe, &fepriv->parameters);
fepriv->parameters.frequency = original_frequency; fepriv->parameters.frequency = original_frequency;
fepriv->parameters.inversion = original_inversion; fepriv->parameters.inversion = original_inversion;
...@@ -359,8 +359,8 @@ static void dvb_frontend_swzigzag(struct dvb_frontend *fe) ...@@ -359,8 +359,8 @@ static void dvb_frontend_swzigzag(struct dvb_frontend *fe)
/* in SCAN mode, we just set the frontend when asked and leave it alone */ /* in SCAN mode, we just set the frontend when asked and leave it alone */
if (fepriv->tune_mode_flags & FE_TUNE_MODE_ONESHOT) { if (fepriv->tune_mode_flags & FE_TUNE_MODE_ONESHOT) {
if (fepriv->state & FESTATE_RETUNE) { if (fepriv->state & FESTATE_RETUNE) {
if (fe->ops->set_frontend) if (fe->ops.set_frontend)
fe->ops->set_frontend(fe, &fepriv->parameters); fe->ops.set_frontend(fe, &fepriv->parameters);
fepriv->state = FESTATE_TUNED; fepriv->state = FESTATE_TUNED;
} }
fepriv->delay = 3*HZ; fepriv->delay = 3*HZ;
...@@ -372,8 +372,8 @@ static void dvb_frontend_swzigzag(struct dvb_frontend *fe) ...@@ -372,8 +372,8 @@ static void dvb_frontend_swzigzag(struct dvb_frontend *fe)
if (fepriv->state & FESTATE_RETUNE) { if (fepriv->state & FESTATE_RETUNE) {
s = 0; s = 0;
} else { } else {
if (fe->ops->read_status) if (fe->ops.read_status)
fe->ops->read_status(fe, &s); fe->ops.read_status(fe, &s);
if (s != fepriv->status) { if (s != fepriv->status) {
dvb_frontend_add_event(fe, s); dvb_frontend_add_event(fe, s);
fepriv->status = s; fepriv->status = s;
...@@ -386,7 +386,7 @@ static void dvb_frontend_swzigzag(struct dvb_frontend *fe) ...@@ -386,7 +386,7 @@ static void dvb_frontend_swzigzag(struct dvb_frontend *fe)
fepriv->state = FESTATE_TUNED; fepriv->state = FESTATE_TUNED;
/* if we're tuned, then we have determined the correct inversion */ /* if we're tuned, then we have determined the correct inversion */
if ((!(fe->ops->info.caps & FE_CAN_INVERSION_AUTO)) && if ((!(fe->ops.info.caps & FE_CAN_INVERSION_AUTO)) &&
(fepriv->parameters.inversion == INVERSION_AUTO)) { (fepriv->parameters.inversion == INVERSION_AUTO)) {
fepriv->parameters.inversion = fepriv->inversion; fepriv->parameters.inversion = fepriv->inversion;
} }
...@@ -410,7 +410,7 @@ static void dvb_frontend_swzigzag(struct dvb_frontend *fe) ...@@ -410,7 +410,7 @@ static void dvb_frontend_swzigzag(struct dvb_frontend *fe)
/* don't actually do anything if we're in the LOSTLOCK state, /* don't actually do anything if we're in the LOSTLOCK state,
* the frontend is set to FE_CAN_RECOVER, and the max_drift is 0 */ * the frontend is set to FE_CAN_RECOVER, and the max_drift is 0 */
if ((fepriv->state & FESTATE_LOSTLOCK) && if ((fepriv->state & FESTATE_LOSTLOCK) &&
(fe->ops->info.caps & FE_CAN_RECOVER) && (fepriv->max_drift == 0)) { (fe->ops.info.caps & FE_CAN_RECOVER) && (fepriv->max_drift == 0)) {
dvb_frontend_swzigzag_update_delay(fepriv, s & FE_HAS_LOCK); dvb_frontend_swzigzag_update_delay(fepriv, s & FE_HAS_LOCK);
return; return;
} }
...@@ -545,16 +545,16 @@ static int dvb_frontend_thread(void *data) ...@@ -545,16 +545,16 @@ static int dvb_frontend_thread(void *data)
if (fepriv->reinitialise) { if (fepriv->reinitialise) {
dvb_frontend_init(fe); dvb_frontend_init(fe);
if (fepriv->tone != -1) { if (fepriv->tone != -1) {
fe->ops->set_tone(fe, fepriv->tone); fe->ops.set_tone(fe, fepriv->tone);
} }
if (fepriv->voltage != -1) { if (fepriv->voltage != -1) {
fe->ops->set_voltage(fe, fepriv->voltage); fe->ops.set_voltage(fe, fepriv->voltage);
} }
fepriv->reinitialise = 0; fepriv->reinitialise = 0;
} }
/* do an iteration of the tuning loop */ /* do an iteration of the tuning loop */
if (fe->ops->tune) { if (fe->ops.tune) {
/* have we been asked to retune? */ /* have we been asked to retune? */
params = NULL; params = NULL;
if (fepriv->state & FESTATE_RETUNE) { if (fepriv->state & FESTATE_RETUNE) {
...@@ -562,7 +562,7 @@ static int dvb_frontend_thread(void *data) ...@@ -562,7 +562,7 @@ static int dvb_frontend_thread(void *data)
fepriv->state = FESTATE_TUNED; fepriv->state = FESTATE_TUNED;
} }
fe->ops->tune(fe, params, fepriv->tune_mode_flags, &fepriv->delay, &s); fe->ops.tune(fe, params, fepriv->tune_mode_flags, &fepriv->delay, &s);
if (s != fepriv->status) { if (s != fepriv->status) {
dvb_frontend_add_event(fe, s); dvb_frontend_add_event(fe, s);
fepriv->status = s; fepriv->status = s;
...@@ -574,15 +574,15 @@ static int dvb_frontend_thread(void *data) ...@@ -574,15 +574,15 @@ static int dvb_frontend_thread(void *data)
if (dvb_shutdown_timeout) { if (dvb_shutdown_timeout) {
if (dvb_powerdown_on_sleep) if (dvb_powerdown_on_sleep)
if (fe->ops->set_voltage) if (fe->ops.set_voltage)
fe->ops->set_voltage(fe, SEC_VOLTAGE_OFF); fe->ops.set_voltage(fe, SEC_VOLTAGE_OFF);
if (fe->ops->tuner_ops.sleep) { if (fe->ops.tuner_ops.sleep) {
fe->ops->tuner_ops.sleep(fe); fe->ops.tuner_ops.sleep(fe);
if (fe->ops->i2c_gate_ctrl) if (fe->ops.i2c_gate_ctrl)
fe->ops->i2c_gate_ctrl(fe, 0); fe->ops.i2c_gate_ctrl(fe, 0);
} }
if (fe->ops->sleep) if (fe->ops.sleep)
fe->ops->sleep(fe); fe->ops.sleep(fe);
} }
fepriv->thread_pid = 0; fepriv->thread_pid = 0;
...@@ -734,7 +734,7 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file, ...@@ -734,7 +734,7 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file,
switch (cmd) { switch (cmd) {
case FE_GET_INFO: { case FE_GET_INFO: {
struct dvb_frontend_info* info = parg; struct dvb_frontend_info* info = parg;
memcpy(info, &fe->ops->info, sizeof(struct dvb_frontend_info)); memcpy(info, &fe->ops.info, sizeof(struct dvb_frontend_info));
/* Force the CAN_INVERSION_AUTO bit on. If the frontend doesn't /* Force the CAN_INVERSION_AUTO bit on. If the frontend doesn't
* do it, it is done for it. */ * do it, it is done for it. */
...@@ -754,58 +754,58 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file, ...@@ -754,58 +754,58 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file,
break; break;
} }
if (fe->ops->read_status) if (fe->ops.read_status)
err = fe->ops->read_status(fe, status); err = fe->ops.read_status(fe, status);
break; break;
} }
case FE_READ_BER: case FE_READ_BER:
if (fe->ops->read_ber) if (fe->ops.read_ber)
err = fe->ops->read_ber(fe, (__u32*) parg); err = fe->ops.read_ber(fe, (__u32*) parg);
break; break;
case FE_READ_SIGNAL_STRENGTH: case FE_READ_SIGNAL_STRENGTH:
if (fe->ops->read_signal_strength) if (fe->ops.read_signal_strength)
err = fe->ops->read_signal_strength(fe, (__u16*) parg); err = fe->ops.read_signal_strength(fe, (__u16*) parg);
break; break;
case FE_READ_SNR: case FE_READ_SNR:
if (fe->ops->read_snr) if (fe->ops.read_snr)
err = fe->ops->read_snr(fe, (__u16*) parg); err = fe->ops.read_snr(fe, (__u16*) parg);
break; break;
case FE_READ_UNCORRECTED_BLOCKS: case FE_READ_UNCORRECTED_BLOCKS:
if (fe->ops->read_ucblocks) if (fe->ops.read_ucblocks)
err = fe->ops->read_ucblocks(fe, (__u32*) parg); err = fe->ops.read_ucblocks(fe, (__u32*) parg);
break; break;
case FE_DISEQC_RESET_OVERLOAD: case FE_DISEQC_RESET_OVERLOAD:
if (fe->ops->diseqc_reset_overload) { if (fe->ops.diseqc_reset_overload) {
err = fe->ops->diseqc_reset_overload(fe); err = fe->ops.diseqc_reset_overload(fe);
fepriv->state = FESTATE_DISEQC; fepriv->state = FESTATE_DISEQC;
fepriv->status = 0; fepriv->status = 0;
} }
break; break;
case FE_DISEQC_SEND_MASTER_CMD: case FE_DISEQC_SEND_MASTER_CMD:
if (fe->ops->diseqc_send_master_cmd) { if (fe->ops.diseqc_send_master_cmd) {
err = fe->ops->diseqc_send_master_cmd(fe, (struct dvb_diseqc_master_cmd*) parg); err = fe->ops.diseqc_send_master_cmd(fe, (struct dvb_diseqc_master_cmd*) parg);
fepriv->state = FESTATE_DISEQC; fepriv->state = FESTATE_DISEQC;
fepriv->status = 0; fepriv->status = 0;
} }
break; break;
case FE_DISEQC_SEND_BURST: case FE_DISEQC_SEND_BURST:
if (fe->ops->diseqc_send_burst) { if (fe->ops.diseqc_send_burst) {
err = fe->ops->diseqc_send_burst(fe, (fe_sec_mini_cmd_t) parg); err = fe->ops.diseqc_send_burst(fe, (fe_sec_mini_cmd_t) parg);
fepriv->state = FESTATE_DISEQC; fepriv->state = FESTATE_DISEQC;
fepriv->status = 0; fepriv->status = 0;
} }
break; break;
case FE_SET_TONE: case FE_SET_TONE:
if (fe->ops->set_tone) { if (fe->ops.set_tone) {
err = fe->ops->set_tone(fe, (fe_sec_tone_mode_t) parg); err = fe->ops.set_tone(fe, (fe_sec_tone_mode_t) parg);
fepriv->tone = (fe_sec_tone_mode_t) parg; fepriv->tone = (fe_sec_tone_mode_t) parg;
fepriv->state = FESTATE_DISEQC; fepriv->state = FESTATE_DISEQC;
fepriv->status = 0; fepriv->status = 0;
...@@ -813,8 +813,8 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file, ...@@ -813,8 +813,8 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file,
break; break;
case FE_SET_VOLTAGE: case FE_SET_VOLTAGE:
if (fe->ops->set_voltage) { if (fe->ops.set_voltage) {
err = fe->ops->set_voltage(fe, (fe_sec_voltage_t) parg); err = fe->ops.set_voltage(fe, (fe_sec_voltage_t) parg);
fepriv->voltage = (fe_sec_voltage_t) parg; fepriv->voltage = (fe_sec_voltage_t) parg;
fepriv->state = FESTATE_DISEQC; fepriv->state = FESTATE_DISEQC;
fepriv->status = 0; fepriv->status = 0;
...@@ -822,11 +822,11 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file, ...@@ -822,11 +822,11 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file,
break; break;
case FE_DISHNETWORK_SEND_LEGACY_CMD: case FE_DISHNETWORK_SEND_LEGACY_CMD:
if (fe->ops->dishnetwork_send_legacy_command) { if (fe->ops.dishnetwork_send_legacy_command) {
err = fe->ops->dishnetwork_send_legacy_command(fe, (unsigned long) parg); err = fe->ops.dishnetwork_send_legacy_command(fe, (unsigned long) parg);
fepriv->state = FESTATE_DISEQC; fepriv->state = FESTATE_DISEQC;
fepriv->status = 0; fepriv->status = 0;
} else if (fe->ops->set_voltage) { } else if (fe->ops.set_voltage) {
/* /*
* NOTE: This is a fallback condition. Some frontends * NOTE: This is a fallback condition. Some frontends
* (stv0299 for instance) take longer than 8msec to * (stv0299 for instance) take longer than 8msec to
...@@ -856,7 +856,7 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file, ...@@ -856,7 +856,7 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file,
/* before sending a command, initialize by sending /* before sending a command, initialize by sending
* a 32ms 18V to the switch * a 32ms 18V to the switch
*/ */
fe->ops->set_voltage(fe, SEC_VOLTAGE_18); fe->ops.set_voltage(fe, SEC_VOLTAGE_18);
dvb_frontend_sleep_until(&nexttime, 32000); dvb_frontend_sleep_until(&nexttime, 32000);
for (i = 0; i < 9; i++) { for (i = 0; i < 9; i++) {
...@@ -864,7 +864,7 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file, ...@@ -864,7 +864,7 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file,
do_gettimeofday(&tv[i + 1]); do_gettimeofday(&tv[i + 1]);
if ((cmd & 0x01) != last) { if ((cmd & 0x01) != last) {
/* set voltage to (last ? 13V : 18V) */ /* set voltage to (last ? 13V : 18V) */
fe->ops->set_voltage(fe, (last) ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18); fe->ops.set_voltage(fe, (last) ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18);
last = (last) ? 0 : 1; last = (last) ? 0 : 1;
} }
cmd = cmd >> 1; cmd = cmd >> 1;
...@@ -884,13 +884,13 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file, ...@@ -884,13 +884,13 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file,
break; break;
case FE_DISEQC_RECV_SLAVE_REPLY: case FE_DISEQC_RECV_SLAVE_REPLY:
if (fe->ops->diseqc_recv_slave_reply) if (fe->ops.diseqc_recv_slave_reply)
err = fe->ops->diseqc_recv_slave_reply(fe, (struct dvb_diseqc_slave_reply*) parg); err = fe->ops.diseqc_recv_slave_reply(fe, (struct dvb_diseqc_slave_reply*) parg);
break; break;
case FE_ENABLE_HIGH_LNB_VOLTAGE: case FE_ENABLE_HIGH_LNB_VOLTAGE:
if (fe->ops->enable_high_lnb_voltage) if (fe->ops.enable_high_lnb_voltage)
err = fe->ops->enable_high_lnb_voltage(fe, (long) parg); err = fe->ops.enable_high_lnb_voltage(fe, (long) parg);
break; break;
case FE_SET_FRONTEND: { case FE_SET_FRONTEND: {
...@@ -908,7 +908,7 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file, ...@@ -908,7 +908,7 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file,
fepriv->parameters.inversion = INVERSION_AUTO; fepriv->parameters.inversion = INVERSION_AUTO;
fetunesettings.parameters.inversion = INVERSION_AUTO; fetunesettings.parameters.inversion = INVERSION_AUTO;
} }
if (fe->ops->info.type == FE_OFDM) { if (fe->ops.info.type == FE_OFDM) {
/* without hierachical coding code_rate_LP is irrelevant, /* without hierachical coding code_rate_LP is irrelevant,
* so we tolerate the otherwise invalid FEC_NONE setting */ * so we tolerate the otherwise invalid FEC_NONE setting */
if (fepriv->parameters.u.ofdm.hierarchy_information == HIERARCHY_NONE && if (fepriv->parameters.u.ofdm.hierarchy_information == HIERARCHY_NONE &&
...@@ -917,13 +917,13 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file, ...@@ -917,13 +917,13 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file,
} }
/* get frontend-specific tuning settings */ /* get frontend-specific tuning settings */
if (fe->ops->get_tune_settings && (fe->ops->get_tune_settings(fe, &fetunesettings) == 0)) { if (fe->ops.get_tune_settings && (fe->ops.get_tune_settings(fe, &fetunesettings) == 0)) {
fepriv->min_delay = (fetunesettings.min_delay_ms * HZ) / 1000; fepriv->min_delay = (fetunesettings.min_delay_ms * HZ) / 1000;
fepriv->max_drift = fetunesettings.max_drift; fepriv->max_drift = fetunesettings.max_drift;
fepriv->step_size = fetunesettings.step_size; fepriv->step_size = fetunesettings.step_size;
} else { } else {
/* default values */ /* default values */
switch(fe->ops->info.type) { switch(fe->ops.info.type) {
case FE_QPSK: case FE_QPSK:
fepriv->min_delay = HZ/20; fepriv->min_delay = HZ/20;
fepriv->step_size = fepriv->parameters.u.qpsk.symbol_rate / 16000; fepriv->step_size = fepriv->parameters.u.qpsk.symbol_rate / 16000;
...@@ -938,8 +938,8 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file, ...@@ -938,8 +938,8 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file,
case FE_OFDM: case FE_OFDM:
fepriv->min_delay = HZ/20; fepriv->min_delay = HZ/20;
fepriv->step_size = fe->ops->info.frequency_stepsize * 2; fepriv->step_size = fe->ops.info.frequency_stepsize * 2;
fepriv->max_drift = (fe->ops->info.frequency_stepsize * 2) + 1; fepriv->max_drift = (fe->ops.info.frequency_stepsize * 2) + 1;
break; break;
case FE_ATSC: case FE_ATSC:
printk("dvb-core: FE_ATSC not handled yet.\n"); printk("dvb-core: FE_ATSC not handled yet.\n");
...@@ -962,9 +962,9 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file, ...@@ -962,9 +962,9 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file,
break; break;
case FE_GET_FRONTEND: case FE_GET_FRONTEND:
if (fe->ops->get_frontend) { if (fe->ops.get_frontend) {
memcpy (parg, &fepriv->parameters, sizeof (struct dvb_frontend_parameters)); memcpy (parg, &fepriv->parameters, sizeof (struct dvb_frontend_parameters));
err = fe->ops->get_frontend(fe, (struct dvb_frontend_parameters*) parg); err = fe->ops.get_frontend(fe, (struct dvb_frontend_parameters*) parg);
} }
break; break;
...@@ -1077,7 +1077,7 @@ int dvb_register_frontend(struct dvb_adapter* dvb, ...@@ -1077,7 +1077,7 @@ int dvb_register_frontend(struct dvb_adapter* dvb,
printk ("DVB: registering frontend %i (%s)...\n", printk ("DVB: registering frontend %i (%s)...\n",
fe->dvb->num, fe->dvb->num,
fe->ops->info.name); fe->ops.info.name);
dvb_register_device (fe->dvb, &fepriv->dvbdev, &dvbdev_template, dvb_register_device (fe->dvb, &fepriv->dvbdev, &dvbdev_template,
fe, DVB_DEVICE_FRONTEND); fe, DVB_DEVICE_FRONTEND);
...@@ -1095,15 +1095,15 @@ int dvb_unregister_frontend(struct dvb_frontend* fe) ...@@ -1095,15 +1095,15 @@ int dvb_unregister_frontend(struct dvb_frontend* fe)
mutex_lock(&frontend_mutex); mutex_lock(&frontend_mutex);
dvb_unregister_device (fepriv->dvbdev); dvb_unregister_device (fepriv->dvbdev);
dvb_frontend_stop (fe); dvb_frontend_stop (fe);
if (fe->ops->tuner_ops.release) { if (fe->ops.tuner_ops.release) {
fe->ops->tuner_ops.release(fe); fe->ops.tuner_ops.release(fe);
if (fe->ops->i2c_gate_ctrl) if (fe->ops.i2c_gate_ctrl)
fe->ops->i2c_gate_ctrl(fe, 0); fe->ops.i2c_gate_ctrl(fe, 0);
} }
if (fe->ops->release) if (fe->ops.release)
fe->ops->release(fe); fe->ops.release(fe);
else else
printk("dvb_frontend: Demodulator (%s) does not have a release callback!\n", fe->ops->info.name); printk("dvb_frontend: Demodulator (%s) does not have a release callback!\n", fe->ops.info.name);
/* fe is invalid now */ /* fe is invalid now */
kfree(fepriv); kfree(fepriv);
mutex_unlock(&frontend_mutex); mutex_unlock(&frontend_mutex);
......
...@@ -140,7 +140,7 @@ struct dvb_fe_events { ...@@ -140,7 +140,7 @@ struct dvb_fe_events {
}; };
struct dvb_frontend { struct dvb_frontend {
struct dvb_frontend_ops* ops; struct dvb_frontend_ops ops;
struct dvb_adapter *dvb; struct dvb_adapter *dvb;
void* demodulator_priv; void* demodulator_priv;
void* tuner_priv; void* tuner_priv;
......
...@@ -360,8 +360,8 @@ static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_device *d) ...@@ -360,8 +360,8 @@ static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_device *d)
memcpy(d->pll_init, bpll, 4); memcpy(d->pll_init, bpll, 4);
d->pll_desc = &dvb_pll_fmd1216me; d->pll_desc = &dvb_pll_fmd1216me;
d->fe->ops->tuner_ops.init = dvb_usb_tuner_init_i2c; d->fe->ops.tuner_ops.init = dvb_usb_tuner_init_i2c;
d->fe->ops->tuner_ops.set_params = dvb_usb_tuner_set_params_i2c; d->fe->ops.tuner_ops.set_params = dvb_usb_tuner_set_params_i2c;
return 0; return 0;
} }
...@@ -370,7 +370,7 @@ static int cxusb_dee1601_tuner_attach(struct dvb_usb_device *d) ...@@ -370,7 +370,7 @@ static int cxusb_dee1601_tuner_attach(struct dvb_usb_device *d)
{ {
d->pll_addr = 0x61; d->pll_addr = 0x61;
d->pll_desc = &dvb_pll_thomson_dtt7579; d->pll_desc = &dvb_pll_thomson_dtt7579;
d->fe->ops->tuner_ops.calc_regs = dvb_usb_tuner_calc_regs; d->fe->ops.tuner_ops.calc_regs = dvb_usb_tuner_calc_regs;
return 0; return 0;
} }
...@@ -378,7 +378,7 @@ static int cxusb_lgz201_tuner_attach(struct dvb_usb_device *d) ...@@ -378,7 +378,7 @@ static int cxusb_lgz201_tuner_attach(struct dvb_usb_device *d)
{ {
d->pll_addr = 0x61; d->pll_addr = 0x61;
d->pll_desc = &dvb_pll_lg_z201; d->pll_desc = &dvb_pll_lg_z201;
d->fe->ops->tuner_ops.calc_regs = dvb_usb_tuner_calc_regs; d->fe->ops.tuner_ops.calc_regs = dvb_usb_tuner_calc_regs;
return 0; return 0;
} }
...@@ -386,13 +386,13 @@ static int cxusb_dtt7579_tuner_attach(struct dvb_usb_device *d) ...@@ -386,13 +386,13 @@ static int cxusb_dtt7579_tuner_attach(struct dvb_usb_device *d)
{ {
d->pll_addr = 0x60; d->pll_addr = 0x60;
d->pll_desc = &dvb_pll_thomson_dtt7579; d->pll_desc = &dvb_pll_thomson_dtt7579;
d->fe->ops->tuner_ops.calc_regs = dvb_usb_tuner_calc_regs; d->fe->ops.tuner_ops.calc_regs = dvb_usb_tuner_calc_regs;
return 0; return 0;
} }
static int cxusb_lgdt3303_tuner_attach(struct dvb_usb_device *d) static int cxusb_lgdt3303_tuner_attach(struct dvb_usb_device *d)
{ {
d->fe->ops->tuner_ops.set_params = cxusb_lgh064f_tuner_set_params; d->fe->ops.tuner_ops.set_params = cxusb_lgh064f_tuner_set_params;
return 0; return 0;
} }
......
...@@ -20,11 +20,12 @@ static int dibusb_dib3000mb_frontend_attach(struct dvb_usb_device *d) ...@@ -20,11 +20,12 @@ static int dibusb_dib3000mb_frontend_attach(struct dvb_usb_device *d)
struct dibusb_state *st = d->priv; struct dibusb_state *st = d->priv;
demod_cfg.demod_address = 0x8; demod_cfg.demod_address = 0x8;
d->fe->ops->tuner_ops.init = dvb_usb_tuner_init_i2c;
d->fe->ops->tuner_ops.set_params = dvb_usb_tuner_set_params_i2c;
if ((d->fe = dib3000mb_attach(&demod_cfg,&d->i2c_adap,&st->ops)) == NULL) if ((d->fe = dib3000mb_attach(&demod_cfg,&d->i2c_adap,&st->ops)) == NULL) {
d->fe->ops.tuner_ops.init = dvb_usb_tuner_init_i2c;
d->fe->ops.tuner_ops.set_params = dvb_usb_tuner_set_params_i2c;
return -ENODEV; return -ENODEV;
}
d->tuner_pass_ctrl = st->ops.tuner_pass_ctrl; d->tuner_pass_ctrl = st->ops.tuner_pass_ctrl;
......
...@@ -129,11 +129,11 @@ static struct nxt6000_config digitv_nxt6000_config = { ...@@ -129,11 +129,11 @@ static struct nxt6000_config digitv_nxt6000_config = {
static int digitv_frontend_attach(struct dvb_usb_device *d) static int digitv_frontend_attach(struct dvb_usb_device *d)
{ {
if ((d->fe = mt352_attach(&digitv_mt352_config, &d->i2c_adap)) != NULL) { if ((d->fe = mt352_attach(&digitv_mt352_config, &d->i2c_adap)) != NULL) {
d->fe->ops->tuner_ops.calc_regs = dvb_usb_tuner_calc_regs; d->fe->ops.tuner_ops.calc_regs = dvb_usb_tuner_calc_regs;
return 0; return 0;
} }
if ((d->fe = nxt6000_attach(&digitv_nxt6000_config, &d->i2c_adap)) != NULL) { if ((d->fe = nxt6000_attach(&digitv_nxt6000_config, &d->i2c_adap)) != NULL) {
d->fe->ops->tuner_ops.set_params = digitv_nxt6000_tuner_set_params; d->fe->ops.tuner_ops.set_params = digitv_nxt6000_tuner_set_params;
return 0; return 0;
} }
return -EIO; return -EIO;
......
...@@ -18,7 +18,6 @@ struct dtt200u_fe_state { ...@@ -18,7 +18,6 @@ struct dtt200u_fe_state {
struct dvb_frontend_parameters fep; struct dvb_frontend_parameters fep;
struct dvb_frontend frontend; struct dvb_frontend frontend;
struct dvb_frontend_ops ops;
}; };
static int dtt200u_fe_read_status(struct dvb_frontend* fe, fe_status_t *stat) static int dtt200u_fe_read_status(struct dvb_frontend* fe, fe_status_t *stat)
...@@ -163,9 +162,8 @@ struct dvb_frontend* dtt200u_fe_attach(struct dvb_usb_device *d) ...@@ -163,9 +162,8 @@ struct dvb_frontend* dtt200u_fe_attach(struct dvb_usb_device *d)
deb_info("attaching frontend dtt200u\n"); deb_info("attaching frontend dtt200u\n");
state->d = d; state->d = d;
memcpy(&state->ops,&dtt200u_fe_ops,sizeof(struct dvb_frontend_ops));
state->frontend.ops = &state->ops; memcpy(&state->frontend.ops,&dtt200u_fe_ops,sizeof(struct dvb_frontend_ops));
state->frontend.demodulator_priv = state; state->frontend.demodulator_priv = state;
return &state->frontend; return &state->frontend;
......
...@@ -183,13 +183,13 @@ int dvb_usb_fe_init(struct dvb_usb_device* d) ...@@ -183,13 +183,13 @@ int dvb_usb_fe_init(struct dvb_usb_device* d)
/* re-assign sleep and wakeup functions */ /* re-assign sleep and wakeup functions */
if (d->fe != NULL) { if (d->fe != NULL) {
d->fe_init = d->fe->ops->init; d->fe->ops->init = dvb_usb_fe_wakeup; d->fe_init = d->fe->ops.init; d->fe->ops.init = dvb_usb_fe_wakeup;
d->fe_sleep = d->fe->ops->sleep; d->fe->ops->sleep = dvb_usb_fe_sleep; d->fe_sleep = d->fe->ops.sleep; d->fe->ops.sleep = dvb_usb_fe_sleep;
if (dvb_register_frontend(&d->dvb_adap, d->fe)) { if (dvb_register_frontend(&d->dvb_adap, d->fe)) {
err("Frontend registration failed."); err("Frontend registration failed.");
if (d->fe->ops->release) if (d->fe->ops.release)
d->fe->ops->release(d->fe); d->fe->ops.release(d->fe);
d->fe = NULL; d->fe = NULL;
return -ENODEV; return -ENODEV;
} }
......
...@@ -63,8 +63,8 @@ int dvb_usb_tuner_init_i2c(struct dvb_frontend *fe) ...@@ -63,8 +63,8 @@ int dvb_usb_tuner_init_i2c(struct dvb_frontend *fe)
deb_pll("pll-buf: %x %x %x %x\n",d->pll_init[0],d->pll_init[1], deb_pll("pll-buf: %x %x %x %x\n",d->pll_init[0],d->pll_init[1],
d->pll_init[2],d->pll_init[3]); d->pll_init[2],d->pll_init[3]);
if (fe->ops->i2c_gate_ctrl) if (fe->ops.i2c_gate_ctrl)
fe->ops->i2c_gate_ctrl(fe, 1); fe->ops.i2c_gate_ctrl(fe, 1);
if (i2c_transfer (&d->i2c_adap, &msg, 1) != 1) { if (i2c_transfer (&d->i2c_adap, &msg, 1) != 1) {
err("tuner i2c write failed for pll_init."); err("tuner i2c write failed for pll_init.");
ret = -EREMOTEIO; ret = -EREMOTEIO;
...@@ -109,8 +109,8 @@ int dvb_usb_tuner_set_params_i2c(struct dvb_frontend *fe, struct dvb_frontend_pa ...@@ -109,8 +109,8 @@ int dvb_usb_tuner_set_params_i2c(struct dvb_frontend *fe, struct dvb_frontend_pa
if (d->tuner_pass_ctrl) if (d->tuner_pass_ctrl)
d->tuner_pass_ctrl(fe,1,d->pll_addr); d->tuner_pass_ctrl(fe,1,d->pll_addr);
if (fe->ops->i2c_gate_ctrl) if (fe->ops.i2c_gate_ctrl)
fe->ops->i2c_gate_ctrl(fe, 1); fe->ops.i2c_gate_ctrl(fe, 1);
if (i2c_transfer (&d->i2c_adap, &msg, 1) != 1) { if (i2c_transfer (&d->i2c_adap, &msg, 1) != 1) {
err("tuner i2c write failed for pll_set."); err("tuner i2c write failed for pll_set.");
ret = -EREMOTEIO; ret = -EREMOTEIO;
......
...@@ -67,7 +67,7 @@ static int umt_tuner_attach (struct dvb_usb_device *d) ...@@ -67,7 +67,7 @@ static int umt_tuner_attach (struct dvb_usb_device *d)
{ {
d->pll_addr = 0x61; d->pll_addr = 0x61;
d->pll_desc = &dvb_pll_tua6034; d->pll_desc = &dvb_pll_tua6034;
d->fe->ops->tuner_ops.calc_regs = dvb_usb_tuner_calc_regs; d->fe->ops.tuner_ops.calc_regs = dvb_usb_tuner_calc_regs;
return 0; return 0;
} }
......
...@@ -287,7 +287,8 @@ struct dvb_frontend * vp702x_fe_attach(struct dvb_usb_device *d) ...@@ -287,7 +287,8 @@ struct dvb_frontend * vp702x_fe_attach(struct dvb_usb_device *d)
goto error; goto error;
s->d = d; s->d = d;
s->fe.ops = &vp702x_fe_ops;
memcpy(&s->fe.ops,&vp702x_fe_ops,sizeof(struct dvb_frontend_ops));
s->fe.demodulator_priv = s; s->fe.demodulator_priv = s;
s->lnb_buf[1] = SET_LNB_POWER; s->lnb_buf[1] = SET_LNB_POWER;
......
...@@ -23,8 +23,6 @@ ...@@ -23,8 +23,6 @@
struct vp7045_fe_state { struct vp7045_fe_state {
struct dvb_frontend fe; struct dvb_frontend fe;
struct dvb_frontend_ops ops;
struct dvb_usb_device *d; struct dvb_usb_device *d;
}; };
...@@ -151,8 +149,7 @@ struct dvb_frontend * vp7045_fe_attach(struct dvb_usb_device *d) ...@@ -151,8 +149,7 @@ struct dvb_frontend * vp7045_fe_attach(struct dvb_usb_device *d)
goto error; goto error;
s->d = d; s->d = d;
memcpy(&s->ops, &vp7045_fe_ops, sizeof(struct dvb_frontend_ops)); memcpy(&s->fe.ops, &vp7045_fe_ops, sizeof(struct dvb_frontend_ops));
s->fe.ops = &s->ops;
s->fe.demodulator_priv = s; s->fe.demodulator_priv = s;
return &s->fe; return &s->fe;
......
...@@ -48,7 +48,6 @@ ...@@ -48,7 +48,6 @@
struct bcm3510_state { struct bcm3510_state {
struct i2c_adapter* i2c; struct i2c_adapter* i2c;
struct dvb_frontend_ops ops;
const struct bcm3510_config* config; const struct bcm3510_config* config;
struct dvb_frontend frontend; struct dvb_frontend frontend;
...@@ -791,10 +790,9 @@ struct dvb_frontend* bcm3510_attach(const struct bcm3510_config *config, ...@@ -791,10 +790,9 @@ struct dvb_frontend* bcm3510_attach(const struct bcm3510_config *config,
state->config = config; state->config = config;
state->i2c = i2c; state->i2c = i2c;
memcpy(&state->ops, &bcm3510_ops, sizeof(struct dvb_frontend_ops));
/* create dvb_frontend */ /* create dvb_frontend */
state->frontend.ops = &state->ops; memcpy(&state->frontend.ops, &bcm3510_ops, sizeof(struct dvb_frontend_ops));
state->frontend.demodulator_priv = state; state->frontend.demodulator_priv = state;
mutex_init(&state->hab_mutex); mutex_init(&state->hab_mutex);
......
...@@ -106,8 +106,8 @@ static int alps_bsbe1_tuner_set_params(struct dvb_frontend* fe, struct dvb_front ...@@ -106,8 +106,8 @@ static int alps_bsbe1_tuner_set_params(struct dvb_frontend* fe, struct dvb_front
data[2] = 0x80 | ((div & 0x18000) >> 10) | 4; data[2] = 0x80 | ((div & 0x18000) >> 10) | 4;
data[3] = (params->frequency > 1530000) ? 0xE0 : 0xE4; data[3] = (params->frequency > 1530000) ? 0xE0 : 0xE4;
if (fe->ops->i2c_gate_ctrl) if (fe->ops.i2c_gate_ctrl)
fe->ops->i2c_gate_ctrl(fe, 1); fe->ops.i2c_gate_ctrl(fe, 1);
ret = i2c_transfer(i2c, &msg, 1); ret = i2c_transfer(i2c, &msg, 1);
return (ret != 1) ? -EIO : 0; return (ret != 1) ? -EIO : 0;
} }
......
...@@ -120,8 +120,8 @@ static int alps_bsru6_tuner_set_params(struct dvb_frontend *fe, struct dvb_front ...@@ -120,8 +120,8 @@ static int alps_bsru6_tuner_set_params(struct dvb_frontend *fe, struct dvb_front
if (params->frequency > 1530000) if (params->frequency > 1530000)
buf[3] = 0xc0; buf[3] = 0xc0;
if (fe->ops->i2c_gate_ctrl) if (fe->ops.i2c_gate_ctrl)
fe->ops->i2c_gate_ctrl(fe, 1); fe->ops.i2c_gate_ctrl(fe, 1);
if (i2c_transfer(i2c, &msg, 1) != 1) if (i2c_transfer(i2c, &msg, 1) != 1)
return -EIO; return -EIO;
return 0; return 0;
......
...@@ -34,8 +34,6 @@ struct cx22700_state { ...@@ -34,8 +34,6 @@ struct cx22700_state {
struct i2c_adapter* i2c; struct i2c_adapter* i2c;
struct dvb_frontend_ops ops;
const struct cx22700_config* config; const struct cx22700_config* config;
struct dvb_frontend frontend; struct dvb_frontend frontend;
...@@ -327,9 +325,9 @@ static int cx22700_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par ...@@ -327,9 +325,9 @@ static int cx22700_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par
cx22700_writereg (state, 0x00, 0x02); /* XXX CHECKME: soft reset*/ cx22700_writereg (state, 0x00, 0x02); /* XXX CHECKME: soft reset*/
cx22700_writereg (state, 0x00, 0x00); cx22700_writereg (state, 0x00, 0x00);
if (fe->ops->tuner_ops.set_params) { if (fe->ops.tuner_ops.set_params) {
fe->ops->tuner_ops.set_params(fe, p); fe->ops.tuner_ops.set_params(fe, p);
if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
} }
cx22700_set_inversion (state, p->inversion); cx22700_set_inversion (state, p->inversion);
...@@ -388,13 +386,12 @@ struct dvb_frontend* cx22700_attach(const struct cx22700_config* config, ...@@ -388,13 +386,12 @@ struct dvb_frontend* cx22700_attach(const struct cx22700_config* config,
/* setup the state */ /* setup the state */
state->config = config; state->config = config;
state->i2c = i2c; state->i2c = i2c;
memcpy(&state->ops, &cx22700_ops, sizeof(struct dvb_frontend_ops));
/* check if the demod is there */ /* check if the demod is there */
if (cx22700_readreg(state, 0x07) < 0) goto error; if (cx22700_readreg(state, 0x07) < 0) goto error;
/* create dvb_frontend */ /* create dvb_frontend */
state->frontend.ops = &state->ops; memcpy(&state->frontend.ops, &cx22700_ops, sizeof(struct dvb_frontend_ops));
state->frontend.demodulator_priv = state; state->frontend.demodulator_priv = state;
return &state->frontend; return &state->frontend;
......
...@@ -40,8 +40,6 @@ struct cx22702_state { ...@@ -40,8 +40,6 @@ struct cx22702_state {
struct i2c_adapter* i2c; struct i2c_adapter* i2c;
struct dvb_frontend_ops ops;
/* configuration settings */ /* configuration settings */
const struct cx22702_config* config; const struct cx22702_config* config;
...@@ -211,9 +209,9 @@ static int cx22702_set_tps (struct dvb_frontend* fe, struct dvb_frontend_paramet ...@@ -211,9 +209,9 @@ static int cx22702_set_tps (struct dvb_frontend* fe, struct dvb_frontend_paramet
u8 val; u8 val;
struct cx22702_state* state = fe->demodulator_priv; struct cx22702_state* state = fe->demodulator_priv;
if (fe->ops->tuner_ops.set_params) { if (fe->ops.tuner_ops.set_params) {
fe->ops->tuner_ops.set_params(fe, p); fe->ops.tuner_ops.set_params(fe, p);
if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
} }
/* set inversion */ /* set inversion */
...@@ -479,7 +477,6 @@ struct dvb_frontend* cx22702_attach(const struct cx22702_config* config, ...@@ -479,7 +477,6 @@ struct dvb_frontend* cx22702_attach(const struct cx22702_config* config,
/* setup the state */ /* setup the state */
state->config = config; state->config = config;
state->i2c = i2c; state->i2c = i2c;
memcpy(&state->ops, &cx22702_ops, sizeof(struct dvb_frontend_ops));
state->prevUCBlocks = 0; state->prevUCBlocks = 0;
/* check if the demod is there */ /* check if the demod is there */
...@@ -487,7 +484,7 @@ struct dvb_frontend* cx22702_attach(const struct cx22702_config* config, ...@@ -487,7 +484,7 @@ struct dvb_frontend* cx22702_attach(const struct cx22702_config* config,
goto error; goto error;
/* create dvb_frontend */ /* create dvb_frontend */
state->frontend.ops = &state->ops; memcpy(&state->frontend.ops, &cx22702_ops, sizeof(struct dvb_frontend_ops));
state->frontend.demodulator_priv = state; state->frontend.demodulator_priv = state;
return &state->frontend; return &state->frontend;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment