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/nxt6000.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/nxt6000.c')
-rw-r--r-- | drivers/media/dvb/frontends/nxt6000.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/media/dvb/frontends/nxt6000.c b/drivers/media/dvb/frontends/nxt6000.c index bca83266ae8b..d313d7dcf386 100644 --- a/drivers/media/dvb/frontends/nxt6000.c +++ b/drivers/media/dvb/frontends/nxt6000.c | |||
@@ -33,7 +33,6 @@ | |||
33 | 33 | ||
34 | struct nxt6000_state { | 34 | struct nxt6000_state { |
35 | struct i2c_adapter* i2c; | 35 | struct i2c_adapter* i2c; |
36 | struct dvb_frontend_ops ops; | ||
37 | /* configuration settings */ | 36 | /* configuration settings */ |
38 | const struct nxt6000_config* config; | 37 | const struct nxt6000_config* config; |
39 | struct dvb_frontend frontend; | 38 | struct dvb_frontend frontend; |
@@ -463,9 +462,9 @@ static int nxt6000_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
463 | struct nxt6000_state* state = fe->demodulator_priv; | 462 | struct nxt6000_state* state = fe->demodulator_priv; |
464 | int result; | 463 | int result; |
465 | 464 | ||
466 | if (fe->ops->tuner_ops.set_params) { | 465 | if (fe->ops.tuner_ops.set_params) { |
467 | fe->ops->tuner_ops.set_params(fe, param); | 466 | fe->ops.tuner_ops.set_params(fe, param); |
468 | if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); | 467 | if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); |
469 | } | 468 | } |
470 | 469 | ||
471 | if ((result = nxt6000_set_bandwidth(state, param->u.ofdm.bandwidth)) < 0) | 470 | if ((result = nxt6000_set_bandwidth(state, param->u.ofdm.bandwidth)) < 0) |
@@ -552,13 +551,12 @@ struct dvb_frontend* nxt6000_attach(const struct nxt6000_config* config, | |||
552 | /* setup the state */ | 551 | /* setup the state */ |
553 | state->config = config; | 552 | state->config = config; |
554 | state->i2c = i2c; | 553 | state->i2c = i2c; |
555 | memcpy(&state->ops, &nxt6000_ops, sizeof(struct dvb_frontend_ops)); | ||
556 | 554 | ||
557 | /* check if the demod is there */ | 555 | /* check if the demod is there */ |
558 | if (nxt6000_readreg(state, OFDM_MSC_REV) != NXT6000ASICDEVICE) goto error; | 556 | if (nxt6000_readreg(state, OFDM_MSC_REV) != NXT6000ASICDEVICE) goto error; |
559 | 557 | ||
560 | /* create dvb_frontend */ | 558 | /* create dvb_frontend */ |
561 | state->frontend.ops = &state->ops; | 559 | memcpy(&state->frontend.ops, &nxt6000_ops, sizeof(struct dvb_frontend_ops)); |
562 | state->frontend.demodulator_priv = state; | 560 | state->frontend.demodulator_priv = state; |
563 | return &state->frontend; | 561 | return &state->frontend; |
564 | 562 | ||