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/dib3000mb.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/dib3000mb.c')
-rw-r--r-- | drivers/media/dvb/frontends/dib3000mb.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/media/dvb/frontends/dib3000mb.c b/drivers/media/dvb/frontends/dib3000mb.c index f2f8071ad1b0..7c6dc7e30900 100644 --- a/drivers/media/dvb/frontends/dib3000mb.c +++ b/drivers/media/dvb/frontends/dib3000mb.c | |||
@@ -60,9 +60,9 @@ static int dib3000mb_set_frontend(struct dvb_frontend* fe, | |||
60 | fe_code_rate_t fe_cr = FEC_NONE; | 60 | fe_code_rate_t fe_cr = FEC_NONE; |
61 | int search_state, seq; | 61 | int search_state, seq; |
62 | 62 | ||
63 | if (tuner && fe->ops->tuner_ops.set_params) { | 63 | if (tuner && fe->ops.tuner_ops.set_params) { |
64 | fe->ops->tuner_ops.set_params(fe, fep); | 64 | fe->ops.tuner_ops.set_params(fe, fep); |
65 | if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); | 65 | if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); |
66 | 66 | ||
67 | deb_setf("bandwidth: "); | 67 | deb_setf("bandwidth: "); |
68 | switch (ofdm->bandwidth) { | 68 | switch (ofdm->bandwidth) { |
@@ -705,7 +705,6 @@ struct dvb_frontend* dib3000mb_attach(const struct dib3000_config* config, | |||
705 | /* setup the state */ | 705 | /* setup the state */ |
706 | state->i2c = i2c; | 706 | state->i2c = i2c; |
707 | memcpy(&state->config,config,sizeof(struct dib3000_config)); | 707 | memcpy(&state->config,config,sizeof(struct dib3000_config)); |
708 | memcpy(&state->ops, &dib3000mb_ops, sizeof(struct dvb_frontend_ops)); | ||
709 | 708 | ||
710 | /* check for the correct demod */ | 709 | /* check for the correct demod */ |
711 | if (rd(DIB3000_REG_MANUFACTOR_ID) != DIB3000_I2C_ID_DIBCOM) | 710 | if (rd(DIB3000_REG_MANUFACTOR_ID) != DIB3000_I2C_ID_DIBCOM) |
@@ -715,7 +714,7 @@ struct dvb_frontend* dib3000mb_attach(const struct dib3000_config* config, | |||
715 | goto error; | 714 | goto error; |
716 | 715 | ||
717 | /* create dvb_frontend */ | 716 | /* create dvb_frontend */ |
718 | state->frontend.ops = &state->ops; | 717 | memcpy(&state->frontend.ops, &dib3000mb_ops, sizeof(struct dvb_frontend_ops)); |
719 | state->frontend.demodulator_priv = state; | 718 | state->frontend.demodulator_priv = state; |
720 | 719 | ||
721 | /* set the xfer operations */ | 720 | /* set the xfer operations */ |