aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends/or51132.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/or51132.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/or51132.c')
-rw-r--r--drivers/media/dvb/frontends/or51132.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/media/dvb/frontends/or51132.c b/drivers/media/dvb/frontends/or51132.c
index 19f75e6ed829..d20ab30c1e83 100644
--- a/drivers/media/dvb/frontends/or51132.c
+++ b/drivers/media/dvb/frontends/or51132.c
@@ -54,7 +54,6 @@ static int debug;
54struct or51132_state 54struct or51132_state
55{ 55{
56 struct i2c_adapter* i2c; 56 struct i2c_adapter* i2c;
57 struct dvb_frontend_ops ops;
58 57
59 /* Configuration settings */ 58 /* Configuration settings */
60 const struct or51132_config* config; 59 const struct or51132_config* config;
@@ -383,9 +382,9 @@ static int or51132_set_parameters(struct dvb_frontend* fe,
383 or51132_setmode(fe); 382 or51132_setmode(fe);
384 } 383 }
385 384
386 if (fe->ops->tuner_ops.set_params) { 385 if (fe->ops.tuner_ops.set_params) {
387 fe->ops->tuner_ops.set_params(fe, param); 386 fe->ops.tuner_ops.set_params(fe, param);
388 if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); 387 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
389 } 388 }
390 389
391 /* Set to current mode */ 390 /* Set to current mode */
@@ -618,12 +617,11 @@ struct dvb_frontend* or51132_attach(const struct or51132_config* config,
618 /* Setup the state */ 617 /* Setup the state */
619 state->config = config; 618 state->config = config;
620 state->i2c = i2c; 619 state->i2c = i2c;
621 memcpy(&state->ops, &or51132_ops, sizeof(struct dvb_frontend_ops));
622 state->current_frequency = -1; 620 state->current_frequency = -1;
623 state->current_modulation = -1; 621 state->current_modulation = -1;
624 622
625 /* Create dvb_frontend */ 623 /* Create dvb_frontend */
626 state->frontend.ops = &state->ops; 624 memcpy(&state->frontend.ops, &or51132_ops, sizeof(struct dvb_frontend_ops));
627 state->frontend.demodulator_priv = state; 625 state->frontend.demodulator_priv = state;
628 return &state->frontend; 626 return &state->frontend;
629 627
@@ -636,7 +634,7 @@ static struct dvb_frontend_ops or51132_ops = {
636 634
637 .info = { 635 .info = {
638 .name = "Oren OR51132 VSB/QAM Frontend", 636 .name = "Oren OR51132 VSB/QAM Frontend",
639 .type = FE_ATSC, 637 .type = FE_ATSC,
640 .frequency_min = 44000000, 638 .frequency_min = 44000000,
641 .frequency_max = 958000000, 639 .frequency_max = 958000000,
642 .frequency_stepsize = 166666, 640 .frequency_stepsize = 166666,