diff options
author | Patrick Boettcher <pb@linuxtv.org> | 2006-05-14 04:01:31 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-06-25 01:00:42 -0400 |
commit | dea74869f3c62b0b7addd67017b22b394e942aac (patch) | |
tree | d1a597caea6615c76f34896cc832fd1371f2e776 /drivers/media/dvb/frontends/stv0299.c | |
parent | 332bed5fc25ab0eb84215ecd89a4acd48219eee0 (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/stv0299.c')
-rw-r--r-- | drivers/media/dvb/frontends/stv0299.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/media/dvb/frontends/stv0299.c b/drivers/media/dvb/frontends/stv0299.c index e91bb5842dc4..96648a75440d 100644 --- a/drivers/media/dvb/frontends/stv0299.c +++ b/drivers/media/dvb/frontends/stv0299.c | |||
@@ -56,7 +56,6 @@ | |||
56 | 56 | ||
57 | struct stv0299_state { | 57 | struct stv0299_state { |
58 | struct i2c_adapter* i2c; | 58 | struct i2c_adapter* i2c; |
59 | struct dvb_frontend_ops ops; | ||
60 | const struct stv0299_config* config; | 59 | const struct stv0299_config* config; |
61 | struct dvb_frontend frontend; | 60 | struct dvb_frontend frontend; |
62 | 61 | ||
@@ -547,9 +546,9 @@ static int stv0299_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
547 | if (state->config->invert) invval = (~invval) & 1; | 546 | if (state->config->invert) invval = (~invval) & 1; |
548 | stv0299_writeregI(state, 0x0c, (stv0299_readreg(state, 0x0c) & 0xfe) | invval); | 547 | stv0299_writeregI(state, 0x0c, (stv0299_readreg(state, 0x0c) & 0xfe) | invval); |
549 | 548 | ||
550 | if (fe->ops->tuner_ops.set_params) { | 549 | if (fe->ops.tuner_ops.set_params) { |
551 | fe->ops->tuner_ops.set_params(fe, p); | 550 | fe->ops.tuner_ops.set_params(fe, p); |
552 | if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); | 551 | if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); |
553 | } | 552 | } |
554 | 553 | ||
555 | stv0299_set_FEC (state, p->u.qpsk.fec_inner); | 554 | stv0299_set_FEC (state, p->u.qpsk.fec_inner); |
@@ -648,7 +647,6 @@ struct dvb_frontend* stv0299_attach(const struct stv0299_config* config, | |||
648 | /* setup the state */ | 647 | /* setup the state */ |
649 | state->config = config; | 648 | state->config = config; |
650 | state->i2c = i2c; | 649 | state->i2c = i2c; |
651 | memcpy(&state->ops, &stv0299_ops, sizeof(struct dvb_frontend_ops)); | ||
652 | state->initialised = 0; | 650 | state->initialised = 0; |
653 | state->tuner_frequency = 0; | 651 | state->tuner_frequency = 0; |
654 | state->symbol_rate = 0; | 652 | state->symbol_rate = 0; |
@@ -665,7 +663,7 @@ struct dvb_frontend* stv0299_attach(const struct stv0299_config* config, | |||
665 | if (id != 0xa1 && id != 0x80) goto error; | 663 | if (id != 0xa1 && id != 0x80) goto error; |
666 | 664 | ||
667 | /* create dvb_frontend */ | 665 | /* create dvb_frontend */ |
668 | state->frontend.ops = &state->ops; | 666 | memcpy(&state->frontend.ops, &stv0299_ops, sizeof(struct dvb_frontend_ops)); |
669 | state->frontend.demodulator_priv = state; | 667 | state->frontend.demodulator_priv = state; |
670 | return &state->frontend; | 668 | return &state->frontend; |
671 | 669 | ||