aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends/tda8083.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/tda8083.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/tda8083.c')
-rw-r--r--drivers/media/dvb/frontends/tda8083.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/media/dvb/frontends/tda8083.c b/drivers/media/dvb/frontends/tda8083.c
index 0aeaec890296..3aa45ebbac3d 100644
--- a/drivers/media/dvb/frontends/tda8083.c
+++ b/drivers/media/dvb/frontends/tda8083.c
@@ -37,7 +37,6 @@
37 37
38struct tda8083_state { 38struct tda8083_state {
39 struct i2c_adapter* i2c; 39 struct i2c_adapter* i2c;
40 struct dvb_frontend_ops ops;
41 /* configuration settings */ 40 /* configuration settings */
42 const struct tda8083_config* config; 41 const struct tda8083_config* config;
43 struct dvb_frontend frontend; 42 struct dvb_frontend frontend;
@@ -293,9 +292,9 @@ static int tda8083_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par
293{ 292{
294 struct tda8083_state* state = fe->demodulator_priv; 293 struct tda8083_state* state = fe->demodulator_priv;
295 294
296 if (fe->ops->tuner_ops.set_params) { 295 if (fe->ops.tuner_ops.set_params) {
297 fe->ops->tuner_ops.set_params(fe, p); 296 fe->ops.tuner_ops.set_params(fe, p);
298 if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); 297 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
299 } 298 }
300 299
301 tda8083_set_inversion (state, p->inversion); 300 tda8083_set_inversion (state, p->inversion);
@@ -397,13 +396,12 @@ struct dvb_frontend* tda8083_attach(const struct tda8083_config* config,
397 /* setup the state */ 396 /* setup the state */
398 state->config = config; 397 state->config = config;
399 state->i2c = i2c; 398 state->i2c = i2c;
400 memcpy(&state->ops, &tda8083_ops, sizeof(struct dvb_frontend_ops));
401 399
402 /* check if the demod is there */ 400 /* check if the demod is there */
403 if ((tda8083_readreg(state, 0x00)) != 0x05) goto error; 401 if ((tda8083_readreg(state, 0x00)) != 0x05) goto error;
404 402
405 /* create dvb_frontend */ 403 /* create dvb_frontend */
406 state->frontend.ops = &state->ops; 404 memcpy(&state->frontend.ops, &tda8083_ops, sizeof(struct dvb_frontend_ops));
407 state->frontend.demodulator_priv = state; 405 state->frontend.demodulator_priv = state;
408 return &state->frontend; 406 return &state->frontend;
409 407