aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends/cx22700.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/cx22700.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/cx22700.c')
-rw-r--r--drivers/media/dvb/frontends/cx22700.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/media/dvb/frontends/cx22700.c b/drivers/media/dvb/frontends/cx22700.c
index 02fee904752e..3c7c09a362b2 100644
--- a/drivers/media/dvb/frontends/cx22700.c
+++ b/drivers/media/dvb/frontends/cx22700.c
@@ -34,8 +34,6 @@ struct cx22700_state {
34 34
35 struct i2c_adapter* i2c; 35 struct i2c_adapter* i2c;
36 36
37 struct dvb_frontend_ops ops;
38
39 const struct cx22700_config* config; 37 const struct cx22700_config* config;
40 38
41 struct dvb_frontend frontend; 39 struct dvb_frontend frontend;
@@ -327,9 +325,9 @@ static int cx22700_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par
327 cx22700_writereg (state, 0x00, 0x02); /* XXX CHECKME: soft reset*/ 325 cx22700_writereg (state, 0x00, 0x02); /* XXX CHECKME: soft reset*/
328 cx22700_writereg (state, 0x00, 0x00); 326 cx22700_writereg (state, 0x00, 0x00);
329 327
330 if (fe->ops->tuner_ops.set_params) { 328 if (fe->ops.tuner_ops.set_params) {
331 fe->ops->tuner_ops.set_params(fe, p); 329 fe->ops.tuner_ops.set_params(fe, p);
332 if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); 330 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
333 } 331 }
334 332
335 cx22700_set_inversion (state, p->inversion); 333 cx22700_set_inversion (state, p->inversion);
@@ -388,13 +386,12 @@ struct dvb_frontend* cx22700_attach(const struct cx22700_config* config,
388 /* setup the state */ 386 /* setup the state */
389 state->config = config; 387 state->config = config;
390 state->i2c = i2c; 388 state->i2c = i2c;
391 memcpy(&state->ops, &cx22700_ops, sizeof(struct dvb_frontend_ops));
392 389
393 /* check if the demod is there */ 390 /* check if the demod is there */
394 if (cx22700_readreg(state, 0x07) < 0) goto error; 391 if (cx22700_readreg(state, 0x07) < 0) goto error;
395 392
396 /* create dvb_frontend */ 393 /* create dvb_frontend */
397 state->frontend.ops = &state->ops; 394 memcpy(&state->frontend.ops, &cx22700_ops, sizeof(struct dvb_frontend_ops));
398 state->frontend.demodulator_priv = state; 395 state->frontend.demodulator_priv = state;
399 return &state->frontend; 396 return &state->frontend;
400 397