aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends/mt352.c
diff options
context:
space:
mode:
authorPatrick Boettcher <pb@linuxtv.org>2006-05-14 04:01:31 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-06-25 01:00:42 -0400
commitdea74869f3c62b0b7addd67017b22b394e942aac (patch)
treed1a597caea6615c76f34896cc832fd1371f2e776 /drivers/media/dvb/frontends/mt352.c
parent332bed5fc25ab0eb84215ecd89a4acd48219eee0 (diff)
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: Patrick Boettcher <pb@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/frontends/mt352.c')
-rw-r--r--drivers/media/dvb/frontends/mt352.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/media/dvb/frontends/mt352.c b/drivers/media/dvb/frontends/mt352.c
index 8601a3f43074..5de7376c94ce 100644
--- a/drivers/media/dvb/frontends/mt352.c
+++ b/drivers/media/dvb/frontends/mt352.c
@@ -45,7 +45,6 @@
45struct mt352_state { 45struct mt352_state {
46 struct i2c_adapter* i2c; 46 struct i2c_adapter* i2c;
47 struct dvb_frontend frontend; 47 struct dvb_frontend frontend;
48 struct dvb_frontend_ops ops;
49 48
50 /* configuration settings */ 49 /* configuration settings */
51 struct mt352_config config; 50 struct mt352_config config;
@@ -288,17 +287,17 @@ static int mt352_set_parameters(struct dvb_frontend* fe,
288 mt352_calc_input_freq(state, buf+6); 287 mt352_calc_input_freq(state, buf+6);
289 288
290 if (state->config.no_tuner) { 289 if (state->config.no_tuner) {
291 if (fe->ops->tuner_ops.set_params) { 290 if (fe->ops.tuner_ops.set_params) {
292 fe->ops->tuner_ops.set_params(fe, param); 291 fe->ops.tuner_ops.set_params(fe, param);
293 if (fe->ops->i2c_gate_ctrl) 292 if (fe->ops.i2c_gate_ctrl)
294 fe->ops->i2c_gate_ctrl(fe, 0); 293 fe->ops.i2c_gate_ctrl(fe, 0);
295 } 294 }
296 295
297 mt352_write(fe, buf, 8); 296 mt352_write(fe, buf, 8);
298 mt352_write(fe, fsm_go, 2); 297 mt352_write(fe, fsm_go, 2);
299 } else { 298 } else {
300 if (fe->ops->tuner_ops.calc_regs) { 299 if (fe->ops.tuner_ops.calc_regs) {
301 fe->ops->tuner_ops.calc_regs(fe, param, buf+8, 5); 300 fe->ops.tuner_ops.calc_regs(fe, param, buf+8, 5);
302 buf[8] <<= 1; 301 buf[8] <<= 1;
303 mt352_write(fe, buf, sizeof(buf)); 302 mt352_write(fe, buf, sizeof(buf));
304 mt352_write(fe, tuner_go, 2); 303 mt352_write(fe, tuner_go, 2);
@@ -550,13 +549,12 @@ struct dvb_frontend* mt352_attach(const struct mt352_config* config,
550 /* setup the state */ 549 /* setup the state */
551 state->i2c = i2c; 550 state->i2c = i2c;
552 memcpy(&state->config,config,sizeof(struct mt352_config)); 551 memcpy(&state->config,config,sizeof(struct mt352_config));
553 memcpy(&state->ops, &mt352_ops, sizeof(struct dvb_frontend_ops));
554 552
555 /* check if the demod is there */ 553 /* check if the demod is there */
556 if (mt352_read_register(state, CHIP_ID) != ID_MT352) goto error; 554 if (mt352_read_register(state, CHIP_ID) != ID_MT352) goto error;
557 555
558 /* create dvb_frontend */ 556 /* create dvb_frontend */
559 state->frontend.ops = &state->ops; 557 memcpy(&state->frontend.ops, &mt352_ops, sizeof(struct dvb_frontend_ops));
560 state->frontend.demodulator_priv = state; 558 state->frontend.demodulator_priv = state;
561 return &state->frontend; 559 return &state->frontend;
562 560