aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends/l64781.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/l64781.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/l64781.c')
-rw-r--r--drivers/media/dvb/frontends/l64781.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/media/dvb/frontends/l64781.c b/drivers/media/dvb/frontends/l64781.c
index fa4a87e0049e..f3bc82e44a28 100644
--- a/drivers/media/dvb/frontends/l64781.c
+++ b/drivers/media/dvb/frontends/l64781.c
@@ -32,7 +32,6 @@
32 32
33struct l64781_state { 33struct l64781_state {
34 struct i2c_adapter* i2c; 34 struct i2c_adapter* i2c;
35 struct dvb_frontend_ops ops;
36 const struct l64781_config* config; 35 const struct l64781_config* config;
37 struct dvb_frontend frontend; 36 struct dvb_frontend frontend;
38 37
@@ -141,9 +140,9 @@ static int apply_frontend_param (struct dvb_frontend* fe, struct dvb_frontend_pa
141 u8 val0x06; 140 u8 val0x06;
142 int bw = p->bandwidth - BANDWIDTH_8_MHZ; 141 int bw = p->bandwidth - BANDWIDTH_8_MHZ;
143 142
144 if (fe->ops->tuner_ops.set_params) { 143 if (fe->ops.tuner_ops.set_params) {
145 fe->ops->tuner_ops.set_params(fe, param); 144 fe->ops.tuner_ops.set_params(fe, param);
146 if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); 145 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
147 } 146 }
148 147
149 if (param->inversion != INVERSION_ON && 148 if (param->inversion != INVERSION_ON &&
@@ -509,7 +508,6 @@ struct dvb_frontend* l64781_attach(const struct l64781_config* config,
509 /* setup the state */ 508 /* setup the state */
510 state->config = config; 509 state->config = config;
511 state->i2c = i2c; 510 state->i2c = i2c;
512 memcpy(&state->ops, &l64781_ops, sizeof(struct dvb_frontend_ops));
513 state->first = 1; 511 state->first = 1;
514 512
515 /** 513 /**
@@ -555,7 +553,7 @@ struct dvb_frontend* l64781_attach(const struct l64781_config* config,
555 } 553 }
556 554
557 /* create dvb_frontend */ 555 /* create dvb_frontend */
558 state->frontend.ops = &state->ops; 556 memcpy(&state->frontend.ops, &l64781_ops, sizeof(struct dvb_frontend_ops));
559 state->frontend.demodulator_priv = state; 557 state->frontend.demodulator_priv = state;
560 return &state->frontend; 558 return &state->frontend;
561 559