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/ves1820.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/ves1820.c')
-rw-r--r-- | drivers/media/dvb/frontends/ves1820.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/media/dvb/frontends/ves1820.c b/drivers/media/dvb/frontends/ves1820.c index 9810e2dcbbec..6bffe85c161c 100644 --- a/drivers/media/dvb/frontends/ves1820.c +++ b/drivers/media/dvb/frontends/ves1820.c | |||
@@ -35,7 +35,6 @@ | |||
35 | 35 | ||
36 | struct ves1820_state { | 36 | struct ves1820_state { |
37 | struct i2c_adapter* i2c; | 37 | struct i2c_adapter* i2c; |
38 | struct dvb_frontend_ops ops; | ||
39 | /* configuration settings */ | 38 | /* configuration settings */ |
40 | const struct ves1820_config* config; | 39 | const struct ves1820_config* config; |
41 | struct dvb_frontend frontend; | 40 | struct dvb_frontend frontend; |
@@ -220,9 +219,9 @@ static int ves1820_set_parameters(struct dvb_frontend* fe, struct dvb_frontend_p | |||
220 | if (real_qam < 0 || real_qam > 4) | 219 | if (real_qam < 0 || real_qam > 4) |
221 | return -EINVAL; | 220 | return -EINVAL; |
222 | 221 | ||
223 | if (fe->ops->tuner_ops.set_params) { | 222 | if (fe->ops.tuner_ops.set_params) { |
224 | fe->ops->tuner_ops.set_params(fe, p); | 223 | fe->ops.tuner_ops.set_params(fe, p); |
225 | if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); | 224 | if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); |
226 | } | 225 | } |
227 | 226 | ||
228 | ves1820_set_symbolrate(state, p->u.qam.symbol_rate); | 227 | ves1820_set_symbolrate(state, p->u.qam.symbol_rate); |
@@ -381,7 +380,6 @@ struct dvb_frontend* ves1820_attach(const struct ves1820_config* config, | |||
381 | goto error; | 380 | goto error; |
382 | 381 | ||
383 | /* setup the state */ | 382 | /* setup the state */ |
384 | memcpy(&state->ops, &ves1820_ops, sizeof(struct dvb_frontend_ops)); | ||
385 | state->reg0 = ves1820_inittab[0]; | 383 | state->reg0 = ves1820_inittab[0]; |
386 | state->config = config; | 384 | state->config = config; |
387 | state->i2c = i2c; | 385 | state->i2c = i2c; |
@@ -394,12 +392,12 @@ struct dvb_frontend* ves1820_attach(const struct ves1820_config* config, | |||
394 | if (verbose) | 392 | if (verbose) |
395 | printk("ves1820: pwm=0x%02x\n", state->pwm); | 393 | printk("ves1820: pwm=0x%02x\n", state->pwm); |
396 | 394 | ||
397 | state->ops.info.symbol_rate_min = (state->config->xin / 2) / 64; /* SACLK/64 == (XIN/2)/64 */ | ||
398 | state->ops.info.symbol_rate_max = (state->config->xin / 2) / 4; /* SACLK/4 */ | ||
399 | |||
400 | /* create dvb_frontend */ | 395 | /* create dvb_frontend */ |
401 | state->frontend.ops = &state->ops; | 396 | memcpy(&state->frontend.ops, &ves1820_ops, sizeof(struct dvb_frontend_ops)); |
397 | state->frontend.ops.info.symbol_rate_min = (state->config->xin / 2) / 64; /* SACLK/64 == (XIN/2)/64 */ | ||
398 | state->frontend.ops.info.symbol_rate_max = (state->config->xin / 2) / 4; /* SACLK/4 */ | ||
402 | state->frontend.demodulator_priv = state; | 399 | state->frontend.demodulator_priv = state; |
400 | |||
403 | return &state->frontend; | 401 | return &state->frontend; |
404 | 402 | ||
405 | error: | 403 | error: |