aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends/lgdt330x.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/lgdt330x.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/lgdt330x.c')
-rw-r--r--drivers/media/dvb/frontends/lgdt330x.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/media/dvb/frontends/lgdt330x.c b/drivers/media/dvb/frontends/lgdt330x.c
index 5deb6445aca5..53bafc7c9f9b 100644
--- a/drivers/media/dvb/frontends/lgdt330x.c
+++ b/drivers/media/dvb/frontends/lgdt330x.c
@@ -60,7 +60,6 @@ if (debug) printk(KERN_DEBUG "lgdt330x: " args); \
60struct lgdt330x_state 60struct lgdt330x_state
61{ 61{
62 struct i2c_adapter* i2c; 62 struct i2c_adapter* i2c;
63 struct dvb_frontend_ops ops;
64 63
65 /* Configuration settings */ 64 /* Configuration settings */
66 const struct lgdt330x_config* config; 65 const struct lgdt330x_config* config;
@@ -400,9 +399,9 @@ static int lgdt330x_set_parameters(struct dvb_frontend* fe,
400 } 399 }
401 400
402 /* Tune to the specified frequency */ 401 /* Tune to the specified frequency */
403 if (fe->ops->tuner_ops.set_params) { 402 if (fe->ops.tuner_ops.set_params) {
404 fe->ops->tuner_ops.set_params(fe, param); 403 fe->ops.tuner_ops.set_params(fe, param);
405 if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); 404 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
406 } 405 }
407 406
408 /* Keep track of the new frequency */ 407 /* Keep track of the new frequency */
@@ -724,16 +723,19 @@ struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config,
724 /* Setup the state */ 723 /* Setup the state */
725 state->config = config; 724 state->config = config;
726 state->i2c = i2c; 725 state->i2c = i2c;
726
727 /* Create dvb_frontend */
727 switch (config->demod_chip) { 728 switch (config->demod_chip) {
728 case LGDT3302: 729 case LGDT3302:
729 memcpy(&state->ops, &lgdt3302_ops, sizeof(struct dvb_frontend_ops)); 730 memcpy(&state->frontend.ops, &lgdt3302_ops, sizeof(struct dvb_frontend_ops));
730 break; 731 break;
731 case LGDT3303: 732 case LGDT3303:
732 memcpy(&state->ops, &lgdt3303_ops, sizeof(struct dvb_frontend_ops)); 733 memcpy(&state->frontend.ops, &lgdt3303_ops, sizeof(struct dvb_frontend_ops));
733 break; 734 break;
734 default: 735 default:
735 goto error; 736 goto error;
736 } 737 }
738 state->frontend.demodulator_priv = state;
737 739
738 /* Verify communication with demod chip */ 740 /* Verify communication with demod chip */
739 if (i2c_read_demod_bytes(state, 2, buf, 1)) 741 if (i2c_read_demod_bytes(state, 2, buf, 1))
@@ -742,9 +744,6 @@ struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config,
742 state->current_frequency = -1; 744 state->current_frequency = -1;
743 state->current_modulation = -1; 745 state->current_modulation = -1;
744 746
745 /* Create dvb_frontend */
746 state->frontend.ops = &state->ops;
747 state->frontend.demodulator_priv = state;
748 return &state->frontend; 747 return &state->frontend;
749 748
750error: 749error: