aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends/sp887x.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/sp887x.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/sp887x.c')
-rw-r--r--drivers/media/dvb/frontends/sp887x.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/media/dvb/frontends/sp887x.c b/drivers/media/dvb/frontends/sp887x.c
index 543dfa145090..b0a2b02f6608 100644
--- a/drivers/media/dvb/frontends/sp887x.c
+++ b/drivers/media/dvb/frontends/sp887x.c
@@ -24,7 +24,6 @@
24 24
25struct sp887x_state { 25struct sp887x_state {
26 struct i2c_adapter* i2c; 26 struct i2c_adapter* i2c;
27 struct dvb_frontend_ops ops;
28 const struct sp887x_config* config; 27 const struct sp887x_config* config;
29 struct dvb_frontend frontend; 28 struct dvb_frontend frontend;
30 29
@@ -353,13 +352,13 @@ static int sp887x_setup_frontend_parameters (struct dvb_frontend* fe,
353 sp887x_microcontroller_stop(state); 352 sp887x_microcontroller_stop(state);
354 353
355 /* setup the PLL */ 354 /* setup the PLL */
356 if (fe->ops->tuner_ops.set_params) { 355 if (fe->ops.tuner_ops.set_params) {
357 fe->ops->tuner_ops.set_params(fe, p); 356 fe->ops.tuner_ops.set_params(fe, p);
358 if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); 357 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
359 } 358 }
360 if (fe->ops->tuner_ops.get_frequency) { 359 if (fe->ops.tuner_ops.get_frequency) {
361 fe->ops->tuner_ops.get_frequency(fe, &actual_freq); 360 fe->ops.tuner_ops.get_frequency(fe, &actual_freq);
362 if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); 361 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
363 } else { 362 } else {
364 actual_freq = p->frequency; 363 actual_freq = p->frequency;
365 } 364 }
@@ -564,14 +563,13 @@ struct dvb_frontend* sp887x_attach(const struct sp887x_config* config,
564 /* setup the state */ 563 /* setup the state */
565 state->config = config; 564 state->config = config;
566 state->i2c = i2c; 565 state->i2c = i2c;
567 memcpy(&state->ops, &sp887x_ops, sizeof(struct dvb_frontend_ops));
568 state->initialised = 0; 566 state->initialised = 0;
569 567
570 /* check if the demod is there */ 568 /* check if the demod is there */
571 if (sp887x_readreg(state, 0x0200) < 0) goto error; 569 if (sp887x_readreg(state, 0x0200) < 0) goto error;
572 570
573 /* create dvb_frontend */ 571 /* create dvb_frontend */
574 state->frontend.ops = &state->ops; 572 memcpy(&state->frontend.ops, &sp887x_ops, sizeof(struct dvb_frontend_ops));
575 state->frontend.demodulator_priv = state; 573 state->frontend.demodulator_priv = state;
576 return &state->frontend; 574 return &state->frontend;
577 575