aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends/cx24110.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/cx24110.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/cx24110.c')
-rw-r--r--drivers/media/dvb/frontends/cx24110.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/media/dvb/frontends/cx24110.c b/drivers/media/dvb/frontends/cx24110.c
index 8d98ffb61e4e..ce3c7398bac9 100644
--- a/drivers/media/dvb/frontends/cx24110.c
+++ b/drivers/media/dvb/frontends/cx24110.c
@@ -36,8 +36,6 @@ struct cx24110_state {
36 36
37 struct i2c_adapter* i2c; 37 struct i2c_adapter* i2c;
38 38
39 struct dvb_frontend_ops ops;
40
41 const struct cx24110_config* config; 39 const struct cx24110_config* config;
42 40
43 struct dvb_frontend frontend; 41 struct dvb_frontend frontend;
@@ -538,9 +536,9 @@ static int cx24110_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par
538 struct cx24110_state *state = fe->demodulator_priv; 536 struct cx24110_state *state = fe->demodulator_priv;
539 537
540 538
541 if (fe->ops->tuner_ops.set_params) { 539 if (fe->ops.tuner_ops.set_params) {
542 fe->ops->tuner_ops.set_params(fe, p); 540 fe->ops.tuner_ops.set_params(fe, p);
543 if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); 541 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
544 } 542 }
545 543
546 cx24110_set_inversion (state, p->inversion); 544 cx24110_set_inversion (state, p->inversion);
@@ -606,7 +604,6 @@ struct dvb_frontend* cx24110_attach(const struct cx24110_config* config,
606 /* setup the state */ 604 /* setup the state */
607 state->config = config; 605 state->config = config;
608 state->i2c = i2c; 606 state->i2c = i2c;
609 memcpy(&state->ops, &cx24110_ops, sizeof(struct dvb_frontend_ops));
610 state->lastber = 0; 607 state->lastber = 0;
611 state->lastbler = 0; 608 state->lastbler = 0;
612 state->lastesn0 = 0; 609 state->lastesn0 = 0;
@@ -616,7 +613,7 @@ struct dvb_frontend* cx24110_attach(const struct cx24110_config* config,
616 if ((ret != 0x5a) && (ret != 0x69)) goto error; 613 if ((ret != 0x5a) && (ret != 0x69)) goto error;
617 614
618 /* create dvb_frontend */ 615 /* create dvb_frontend */
619 state->frontend.ops = &state->ops; 616 memcpy(&state->frontend.ops, &cx24110_ops, sizeof(struct dvb_frontend_ops));
620 state->frontend.demodulator_priv = state; 617 state->frontend.demodulator_priv = state;
621 return &state->frontend; 618 return &state->frontend;
622 619