aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends
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
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')
-rw-r--r--drivers/media/dvb/frontends/bcm3510.c4
-rw-r--r--drivers/media/dvb/frontends/bsbe1.h4
-rw-r--r--drivers/media/dvb/frontends/bsru6.h4
-rw-r--r--drivers/media/dvb/frontends/cx22700.c11
-rw-r--r--drivers/media/dvb/frontends/cx22702.c11
-rw-r--r--drivers/media/dvb/frontends/cx24110.c11
-rw-r--r--drivers/media/dvb/frontends/cx24123.c8
-rw-r--r--drivers/media/dvb/frontends/dib3000-common.h2
-rw-r--r--drivers/media/dvb/frontends/dib3000mb.c9
-rw-r--r--drivers/media/dvb/frontends/dib3000mc.c12
-rw-r--r--drivers/media/dvb/frontends/dvb-pll.c20
-rw-r--r--drivers/media/dvb/frontends/dvb_dummy_fe.c16
-rw-r--r--drivers/media/dvb/frontends/isl6421.c14
-rw-r--r--drivers/media/dvb/frontends/l64781.c10
-rw-r--r--drivers/media/dvb/frontends/lg_h06xf.h8
-rw-r--r--drivers/media/dvb/frontends/lgdt330x.c17
-rw-r--r--drivers/media/dvb/frontends/lnbp21.c14
-rw-r--r--drivers/media/dvb/frontends/mt312.c27
-rw-r--r--drivers/media/dvb/frontends/mt352.c16
-rw-r--r--drivers/media/dvb/frontends/nxt200x.c8
-rw-r--r--drivers/media/dvb/frontends/nxt6000.c10
-rw-r--r--drivers/media/dvb/frontends/or51132.c12
-rw-r--r--drivers/media/dvb/frontends/or51211.c4
-rw-r--r--drivers/media/dvb/frontends/s5h1420.c22
-rw-r--r--drivers/media/dvb/frontends/sp8870.c11
-rw-r--r--drivers/media/dvb/frontends/sp887x.c16
-rw-r--r--drivers/media/dvb/frontends/stv0297.c10
-rw-r--r--drivers/media/dvb/frontends/stv0299.c10
-rw-r--r--drivers/media/dvb/frontends/tda10021.c10
-rw-r--r--drivers/media/dvb/frontends/tda1004x.c13
-rw-r--r--drivers/media/dvb/frontends/tda8083.c10
-rw-r--r--drivers/media/dvb/frontends/ves1820.c16
-rw-r--r--drivers/media/dvb/frontends/ves1x93.c10
-rw-r--r--drivers/media/dvb/frontends/zl10353.c14
34 files changed, 164 insertions, 230 deletions
diff --git a/drivers/media/dvb/frontends/bcm3510.c b/drivers/media/dvb/frontends/bcm3510.c
index 1708a1d4893e..baeb311de893 100644
--- a/drivers/media/dvb/frontends/bcm3510.c
+++ b/drivers/media/dvb/frontends/bcm3510.c
@@ -48,7 +48,6 @@
48struct bcm3510_state { 48struct bcm3510_state {
49 49
50 struct i2c_adapter* i2c; 50 struct i2c_adapter* i2c;
51 struct dvb_frontend_ops ops;
52 const struct bcm3510_config* config; 51 const struct bcm3510_config* config;
53 struct dvb_frontend frontend; 52 struct dvb_frontend frontend;
54 53
@@ -791,10 +790,9 @@ struct dvb_frontend* bcm3510_attach(const struct bcm3510_config *config,
791 790
792 state->config = config; 791 state->config = config;
793 state->i2c = i2c; 792 state->i2c = i2c;
794 memcpy(&state->ops, &bcm3510_ops, sizeof(struct dvb_frontend_ops));
795 793
796 /* create dvb_frontend */ 794 /* create dvb_frontend */
797 state->frontend.ops = &state->ops; 795 memcpy(&state->frontend.ops, &bcm3510_ops, sizeof(struct dvb_frontend_ops));
798 state->frontend.demodulator_priv = state; 796 state->frontend.demodulator_priv = state;
799 797
800 mutex_init(&state->hab_mutex); 798 mutex_init(&state->hab_mutex);
diff --git a/drivers/media/dvb/frontends/bsbe1.h b/drivers/media/dvb/frontends/bsbe1.h
index b2aeddb14e16..d8f65738e5d2 100644
--- a/drivers/media/dvb/frontends/bsbe1.h
+++ b/drivers/media/dvb/frontends/bsbe1.h
@@ -106,8 +106,8 @@ static int alps_bsbe1_tuner_set_params(struct dvb_frontend* fe, struct dvb_front
106 data[2] = 0x80 | ((div & 0x18000) >> 10) | 4; 106 data[2] = 0x80 | ((div & 0x18000) >> 10) | 4;
107 data[3] = (params->frequency > 1530000) ? 0xE0 : 0xE4; 107 data[3] = (params->frequency > 1530000) ? 0xE0 : 0xE4;
108 108
109 if (fe->ops->i2c_gate_ctrl) 109 if (fe->ops.i2c_gate_ctrl)
110 fe->ops->i2c_gate_ctrl(fe, 1); 110 fe->ops.i2c_gate_ctrl(fe, 1);
111 ret = i2c_transfer(i2c, &msg, 1); 111 ret = i2c_transfer(i2c, &msg, 1);
112 return (ret != 1) ? -EIO : 0; 112 return (ret != 1) ? -EIO : 0;
113} 113}
diff --git a/drivers/media/dvb/frontends/bsru6.h b/drivers/media/dvb/frontends/bsru6.h
index 5533512b04c6..e231cd84b3a1 100644
--- a/drivers/media/dvb/frontends/bsru6.h
+++ b/drivers/media/dvb/frontends/bsru6.h
@@ -120,8 +120,8 @@ static int alps_bsru6_tuner_set_params(struct dvb_frontend *fe, struct dvb_front
120 if (params->frequency > 1530000) 120 if (params->frequency > 1530000)
121 buf[3] = 0xc0; 121 buf[3] = 0xc0;
122 122
123 if (fe->ops->i2c_gate_ctrl) 123 if (fe->ops.i2c_gate_ctrl)
124 fe->ops->i2c_gate_ctrl(fe, 1); 124 fe->ops.i2c_gate_ctrl(fe, 1);
125 if (i2c_transfer(i2c, &msg, 1) != 1) 125 if (i2c_transfer(i2c, &msg, 1) != 1)
126 return -EIO; 126 return -EIO;
127 return 0; 127 return 0;
diff --git a/drivers/media/dvb/frontends/cx22700.c b/drivers/media/dvb/frontends/cx22700.c
index 02fee904752e..3c7c09a362b2 100644
--- a/drivers/media/dvb/frontends/cx22700.c
+++ b/drivers/media/dvb/frontends/cx22700.c
@@ -34,8 +34,6 @@ struct cx22700_state {
34 34
35 struct i2c_adapter* i2c; 35 struct i2c_adapter* i2c;
36 36
37 struct dvb_frontend_ops ops;
38
39 const struct cx22700_config* config; 37 const struct cx22700_config* config;
40 38
41 struct dvb_frontend frontend; 39 struct dvb_frontend frontend;
@@ -327,9 +325,9 @@ static int cx22700_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par
327 cx22700_writereg (state, 0x00, 0x02); /* XXX CHECKME: soft reset*/ 325 cx22700_writereg (state, 0x00, 0x02); /* XXX CHECKME: soft reset*/
328 cx22700_writereg (state, 0x00, 0x00); 326 cx22700_writereg (state, 0x00, 0x00);
329 327
330 if (fe->ops->tuner_ops.set_params) { 328 if (fe->ops.tuner_ops.set_params) {
331 fe->ops->tuner_ops.set_params(fe, p); 329 fe->ops.tuner_ops.set_params(fe, p);
332 if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); 330 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
333 } 331 }
334 332
335 cx22700_set_inversion (state, p->inversion); 333 cx22700_set_inversion (state, p->inversion);
@@ -388,13 +386,12 @@ struct dvb_frontend* cx22700_attach(const struct cx22700_config* config,
388 /* setup the state */ 386 /* setup the state */
389 state->config = config; 387 state->config = config;
390 state->i2c = i2c; 388 state->i2c = i2c;
391 memcpy(&state->ops, &cx22700_ops, sizeof(struct dvb_frontend_ops));
392 389
393 /* check if the demod is there */ 390 /* check if the demod is there */
394 if (cx22700_readreg(state, 0x07) < 0) goto error; 391 if (cx22700_readreg(state, 0x07) < 0) goto error;
395 392
396 /* create dvb_frontend */ 393 /* create dvb_frontend */
397 state->frontend.ops = &state->ops; 394 memcpy(&state->frontend.ops, &cx22700_ops, sizeof(struct dvb_frontend_ops));
398 state->frontend.demodulator_priv = state; 395 state->frontend.demodulator_priv = state;
399 return &state->frontend; 396 return &state->frontend;
400 397
diff --git a/drivers/media/dvb/frontends/cx22702.c b/drivers/media/dvb/frontends/cx22702.c
index a129fc9cba30..4106d46c957f 100644
--- a/drivers/media/dvb/frontends/cx22702.c
+++ b/drivers/media/dvb/frontends/cx22702.c
@@ -40,8 +40,6 @@ struct cx22702_state {
40 40
41 struct i2c_adapter* i2c; 41 struct i2c_adapter* i2c;
42 42
43 struct dvb_frontend_ops ops;
44
45 /* configuration settings */ 43 /* configuration settings */
46 const struct cx22702_config* config; 44 const struct cx22702_config* config;
47 45
@@ -211,9 +209,9 @@ static int cx22702_set_tps (struct dvb_frontend* fe, struct dvb_frontend_paramet
211 u8 val; 209 u8 val;
212 struct cx22702_state* state = fe->demodulator_priv; 210 struct cx22702_state* state = fe->demodulator_priv;
213 211
214 if (fe->ops->tuner_ops.set_params) { 212 if (fe->ops.tuner_ops.set_params) {
215 fe->ops->tuner_ops.set_params(fe, p); 213 fe->ops.tuner_ops.set_params(fe, p);
216 if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); 214 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
217 } 215 }
218 216
219 /* set inversion */ 217 /* set inversion */
@@ -479,7 +477,6 @@ struct dvb_frontend* cx22702_attach(const struct cx22702_config* config,
479 /* setup the state */ 477 /* setup the state */
480 state->config = config; 478 state->config = config;
481 state->i2c = i2c; 479 state->i2c = i2c;
482 memcpy(&state->ops, &cx22702_ops, sizeof(struct dvb_frontend_ops));
483 state->prevUCBlocks = 0; 480 state->prevUCBlocks = 0;
484 481
485 /* check if the demod is there */ 482 /* check if the demod is there */
@@ -487,7 +484,7 @@ struct dvb_frontend* cx22702_attach(const struct cx22702_config* config,
487 goto error; 484 goto error;
488 485
489 /* create dvb_frontend */ 486 /* create dvb_frontend */
490 state->frontend.ops = &state->ops; 487 memcpy(&state->frontend.ops, &cx22702_ops, sizeof(struct dvb_frontend_ops));
491 state->frontend.demodulator_priv = state; 488 state->frontend.demodulator_priv = state;
492 return &state->frontend; 489 return &state->frontend;
493 490
diff --git a/drivers/media/dvb/frontends/cx24110.c b/drivers/media/dvb/frontends/cx24110.c
index 8d98ffb61e4e..ce3c7398bac9 100644
--- a/drivers/media/dvb/frontends/cx24110.c
+++ b/drivers/media/dvb/frontends/cx24110.c
@@ -36,8 +36,6 @@ struct cx24110_state {
36 36
37 struct i2c_adapter* i2c; 37 struct i2c_adapter* i2c;
38 38
39 struct dvb_frontend_ops ops;
40
41 const struct cx24110_config* config; 39 const struct cx24110_config* config;
42 40
43 struct dvb_frontend frontend; 41 struct dvb_frontend frontend;
@@ -538,9 +536,9 @@ static int cx24110_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par
538 struct cx24110_state *state = fe->demodulator_priv; 536 struct cx24110_state *state = fe->demodulator_priv;
539 537
540 538
541 if (fe->ops->tuner_ops.set_params) { 539 if (fe->ops.tuner_ops.set_params) {
542 fe->ops->tuner_ops.set_params(fe, p); 540 fe->ops.tuner_ops.set_params(fe, p);
543 if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); 541 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
544 } 542 }
545 543
546 cx24110_set_inversion (state, p->inversion); 544 cx24110_set_inversion (state, p->inversion);
@@ -606,7 +604,6 @@ struct dvb_frontend* cx24110_attach(const struct cx24110_config* config,
606 /* setup the state */ 604 /* setup the state */
607 state->config = config; 605 state->config = config;
608 state->i2c = i2c; 606 state->i2c = i2c;
609 memcpy(&state->ops, &cx24110_ops, sizeof(struct dvb_frontend_ops));
610 state->lastber = 0; 607 state->lastber = 0;
611 state->lastbler = 0; 608 state->lastbler = 0;
612 state->lastesn0 = 0; 609 state->lastesn0 = 0;
@@ -616,7 +613,7 @@ struct dvb_frontend* cx24110_attach(const struct cx24110_config* config,
616 if ((ret != 0x5a) && (ret != 0x69)) goto error; 613 if ((ret != 0x5a) && (ret != 0x69)) goto error;
617 614
618 /* create dvb_frontend */ 615 /* create dvb_frontend */
619 state->frontend.ops = &state->ops; 616 memcpy(&state->frontend.ops, &cx24110_ops, sizeof(struct dvb_frontend_ops));
620 state->frontend.demodulator_priv = state; 617 state->frontend.demodulator_priv = state;
621 return &state->frontend; 618 return &state->frontend;
622 619
diff --git a/drivers/media/dvb/frontends/cx24123.c b/drivers/media/dvb/frontends/cx24123.c
index c71422964064..f2f795cba56a 100644
--- a/drivers/media/dvb/frontends/cx24123.c
+++ b/drivers/media/dvb/frontends/cx24123.c
@@ -41,7 +41,6 @@ static int debug;
41struct cx24123_state 41struct cx24123_state
42{ 42{
43 struct i2c_adapter* i2c; 43 struct i2c_adapter* i2c;
44 struct dvb_frontend_ops ops;
45 const struct cx24123_config* config; 44 const struct cx24123_config* config;
46 45
47 struct dvb_frontend frontend; 46 struct dvb_frontend frontend;
@@ -429,8 +428,8 @@ static int cx24123_set_symbolrate(struct cx24123_state* state, u32 srate)
429 u8 pll_mult; 428 u8 pll_mult;
430 429
431 /* check if symbol rate is within limits */ 430 /* check if symbol rate is within limits */
432 if ((srate > state->ops.info.symbol_rate_max) || 431 if ((srate > state->frontend.ops.info.symbol_rate_max) ||
433 (srate < state->ops.info.symbol_rate_min)) 432 (srate < state->frontend.ops.info.symbol_rate_min))
434 return -EOPNOTSUPP;; 433 return -EOPNOTSUPP;;
435 434
436 /* choose the sampling rate high enough for the required operation, 435 /* choose the sampling rate high enough for the required operation,
@@ -950,7 +949,6 @@ struct dvb_frontend* cx24123_attach(const struct cx24123_config* config,
950 /* setup the state */ 949 /* setup the state */
951 state->config = config; 950 state->config = config;
952 state->i2c = i2c; 951 state->i2c = i2c;
953 memcpy(&state->ops, &cx24123_ops, sizeof(struct dvb_frontend_ops));
954 state->lastber = 0; 952 state->lastber = 0;
955 state->snr = 0; 953 state->snr = 0;
956 state->VCAarg = 0; 954 state->VCAarg = 0;
@@ -968,7 +966,7 @@ struct dvb_frontend* cx24123_attach(const struct cx24123_config* config,
968 } 966 }
969 967
970 /* create dvb_frontend */ 968 /* create dvb_frontend */
971 state->frontend.ops = &state->ops; 969 memcpy(&state->frontend.ops, &cx24123_ops, sizeof(struct dvb_frontend_ops));
972 state->frontend.demodulator_priv = state; 970 state->frontend.demodulator_priv = state;
973 return &state->frontend; 971 return &state->frontend;
974 972
diff --git a/drivers/media/dvb/frontends/dib3000-common.h b/drivers/media/dvb/frontends/dib3000-common.h
index c31d6df15472..be1c0d3e1389 100644
--- a/drivers/media/dvb/frontends/dib3000-common.h
+++ b/drivers/media/dvb/frontends/dib3000-common.h
@@ -38,8 +38,6 @@
38struct dib3000_state { 38struct dib3000_state {
39 struct i2c_adapter* i2c; 39 struct i2c_adapter* i2c;
40 40
41 struct dvb_frontend_ops ops;
42
43/* configuration settings */ 41/* configuration settings */
44 struct dib3000_config config; 42 struct dib3000_config config;
45 43
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 */
diff --git a/drivers/media/dvb/frontends/dib3000mc.c b/drivers/media/dvb/frontends/dib3000mc.c
index 68a443b3d504..6c3be2529980 100644
--- a/drivers/media/dvb/frontends/dib3000mc.c
+++ b/drivers/media/dvb/frontends/dib3000mc.c
@@ -462,9 +462,9 @@ static int dib3000mc_set_frontend(struct dvb_frontend* fe,
462 int search_state,auto_val; 462 int search_state,auto_val;
463 u16 val; 463 u16 val;
464 464
465 if (tuner && fe->ops->tuner_ops.set_params) { /* initial call from dvb */ 465 if (tuner && fe->ops.tuner_ops.set_params) { /* initial call from dvb */
466 fe->ops->tuner_ops.set_params(fe, fep); 466 fe->ops.tuner_ops.set_params(fe, fep);
467 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);
468 468
469 state->last_tuned_freq = fep->frequency; 469 state->last_tuned_freq = fep->frequency;
470 // if (!scanboost) { 470 // if (!scanboost) {
@@ -837,7 +837,6 @@ struct dvb_frontend* dib3000mc_attach(const struct dib3000_config* config,
837 /* setup the state */ 837 /* setup the state */
838 state->i2c = i2c; 838 state->i2c = i2c;
839 memcpy(&state->config,config,sizeof(struct dib3000_config)); 839 memcpy(&state->config,config,sizeof(struct dib3000_config));
840 memcpy(&state->ops, &dib3000mc_ops, sizeof(struct dvb_frontend_ops));
841 840
842 /* check for the correct demod */ 841 /* check for the correct demod */
843 if (rd(DIB3000_REG_MANUFACTOR_ID) != DIB3000_I2C_ID_DIBCOM) 842 if (rd(DIB3000_REG_MANUFACTOR_ID) != DIB3000_I2C_ID_DIBCOM)
@@ -857,7 +856,7 @@ struct dvb_frontend* dib3000mc_attach(const struct dib3000_config* config,
857 } 856 }
858 857
859 /* create dvb_frontend */ 858 /* create dvb_frontend */
860 state->frontend.ops = &state->ops; 859 memcpy(&state->frontend.ops, &dib3000mc_ops, sizeof(struct dvb_frontend_ops));
861 state->frontend.demodulator_priv = state; 860 state->frontend.demodulator_priv = state;
862 861
863 /* set the xfer operations */ 862 /* set the xfer operations */
@@ -874,6 +873,7 @@ error:
874 kfree(state); 873 kfree(state);
875 return NULL; 874 return NULL;
876} 875}
876EXPORT_SYMBOL(dib3000mc_attach);
877 877
878static struct dvb_frontend_ops dib3000mc_ops = { 878static struct dvb_frontend_ops dib3000mc_ops = {
879 879
@@ -912,5 +912,3 @@ static struct dvb_frontend_ops dib3000mc_ops = {
912MODULE_AUTHOR(DRIVER_AUTHOR); 912MODULE_AUTHOR(DRIVER_AUTHOR);
913MODULE_DESCRIPTION(DRIVER_DESC); 913MODULE_DESCRIPTION(DRIVER_DESC);
914MODULE_LICENSE("GPL"); 914MODULE_LICENSE("GPL");
915
916EXPORT_SYMBOL(dib3000mc_attach);
diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c
index a1a4be41e03e..a189683454b7 100644
--- a/drivers/media/dvb/frontends/dvb-pll.c
+++ b/drivers/media/dvb/frontends/dvb-pll.c
@@ -505,8 +505,8 @@ static int dvb_pll_sleep(struct dvb_frontend *fe)
505 buf[2] = priv->pll_desc->entries[i].config; 505 buf[2] = priv->pll_desc->entries[i].config;
506 buf[3] = priv->pll_desc->entries[i].cb; 506 buf[3] = priv->pll_desc->entries[i].cb;
507 507
508 if (fe->ops->i2c_gate_ctrl) 508 if (fe->ops.i2c_gate_ctrl)
509 fe->ops->i2c_gate_ctrl(fe, 1); 509 fe->ops.i2c_gate_ctrl(fe, 1);
510 if ((result = i2c_transfer(priv->i2c, &msg, 1)) != 1) { 510 if ((result = i2c_transfer(priv->i2c, &msg, 1)) != 1) {
511 return result; 511 return result;
512 } 512 }
@@ -529,15 +529,15 @@ static int dvb_pll_set_params(struct dvb_frontend *fe, struct dvb_frontend_param
529 return -EINVAL; 529 return -EINVAL;
530 530
531 // DVBT bandwidth only just now 531 // DVBT bandwidth only just now
532 if (fe->ops->info.type == FE_OFDM) { 532 if (fe->ops.info.type == FE_OFDM) {
533 bandwidth = params->u.ofdm.bandwidth; 533 bandwidth = params->u.ofdm.bandwidth;
534 } 534 }
535 535
536 if ((result = dvb_pll_configure(priv->pll_desc, buf, params->frequency, bandwidth)) != 0) 536 if ((result = dvb_pll_configure(priv->pll_desc, buf, params->frequency, bandwidth)) != 0)
537 return result; 537 return result;
538 538
539 if (fe->ops->i2c_gate_ctrl) 539 if (fe->ops.i2c_gate_ctrl)
540 fe->ops->i2c_gate_ctrl(fe, 1); 540 fe->ops.i2c_gate_ctrl(fe, 1);
541 if ((result = i2c_transfer(priv->i2c, &msg, 1)) != 1) { 541 if ((result = i2c_transfer(priv->i2c, &msg, 1)) != 1) {
542 return result; 542 return result;
543 } 543 }
@@ -567,7 +567,7 @@ static int dvb_pll_calc_regs(struct dvb_frontend *fe, struct dvb_frontend_parame
567 return -EINVAL; 567 return -EINVAL;
568 568
569 // DVBT bandwidth only just now 569 // DVBT bandwidth only just now
570 if (fe->ops->info.type == FE_OFDM) { 570 if (fe->ops.info.type == FE_OFDM) {
571 bandwidth = params->u.ofdm.bandwidth; 571 bandwidth = params->u.ofdm.bandwidth;
572 } 572 }
573 573
@@ -623,10 +623,10 @@ int dvb_pll_attach(struct dvb_frontend *fe, int pll_addr, struct i2c_adapter *i2
623 priv->i2c = i2c; 623 priv->i2c = i2c;
624 priv->pll_desc = desc; 624 priv->pll_desc = desc;
625 625
626 memcpy(&fe->ops->tuner_ops, &dvb_pll_tuner_ops, sizeof(struct dvb_tuner_ops)); 626 memcpy(&fe->ops.tuner_ops, &dvb_pll_tuner_ops, sizeof(struct dvb_tuner_ops));
627 strncpy(fe->ops->tuner_ops.info.name, desc->name, 128); 627 strncpy(fe->ops.tuner_ops.info.name, desc->name, 128);
628 fe->ops->tuner_ops.info.frequency_min = desc->min; 628 fe->ops.tuner_ops.info.frequency_min = desc->min;
629 fe->ops->tuner_ops.info.frequency_min = desc->max; 629 fe->ops.tuner_ops.info.frequency_min = desc->max;
630 630
631 fe->tuner_priv = priv; 631 fe->tuner_priv = priv;
632 return 0; 632 return 0;
diff --git a/drivers/media/dvb/frontends/dvb_dummy_fe.c b/drivers/media/dvb/frontends/dvb_dummy_fe.c
index 78ea4ff03e68..6271b1e7f6ab 100644
--- a/drivers/media/dvb/frontends/dvb_dummy_fe.c
+++ b/drivers/media/dvb/frontends/dvb_dummy_fe.c
@@ -30,7 +30,6 @@
30 30
31 31
32struct dvb_dummy_fe_state { 32struct dvb_dummy_fe_state {
33 struct dvb_frontend_ops ops;
34 struct dvb_frontend frontend; 33 struct dvb_frontend frontend;
35}; 34};
36 35
@@ -121,11 +120,8 @@ struct dvb_frontend* dvb_dummy_fe_ofdm_attach(void)
121 state = kmalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL); 120 state = kmalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL);
122 if (state == NULL) goto error; 121 if (state == NULL) goto error;
123 122
124 /* setup the state */
125 memcpy(&state->ops, &dvb_dummy_fe_ofdm_ops, sizeof(struct dvb_frontend_ops));
126
127 /* create dvb_frontend */ 123 /* create dvb_frontend */
128 state->frontend.ops = &state->ops; 124 memcpy(&state->frontend.ops, &dvb_dummy_fe_ofdm_ops, sizeof(struct dvb_frontend_ops));
129 state->frontend.demodulator_priv = state; 125 state->frontend.demodulator_priv = state;
130 return &state->frontend; 126 return &state->frontend;
131 127
@@ -144,11 +140,8 @@ struct dvb_frontend* dvb_dummy_fe_qpsk_attach()
144 state = kmalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL); 140 state = kmalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL);
145 if (state == NULL) goto error; 141 if (state == NULL) goto error;
146 142
147 /* setup the state */
148 memcpy(&state->ops, &dvb_dummy_fe_qpsk_ops, sizeof(struct dvb_frontend_ops));
149
150 /* create dvb_frontend */ 143 /* create dvb_frontend */
151 state->frontend.ops = &state->ops; 144 memcpy(&state->frontend.ops, &dvb_dummy_fe_qpsk_ops, sizeof(struct dvb_frontend_ops));
152 state->frontend.demodulator_priv = state; 145 state->frontend.demodulator_priv = state;
153 return &state->frontend; 146 return &state->frontend;
154 147
@@ -167,11 +160,8 @@ struct dvb_frontend* dvb_dummy_fe_qam_attach()
167 state = kmalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL); 160 state = kmalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL);
168 if (state == NULL) goto error; 161 if (state == NULL) goto error;
169 162
170 /* setup the state */
171 memcpy(&state->ops, &dvb_dummy_fe_qam_ops, sizeof(struct dvb_frontend_ops));
172
173 /* create dvb_frontend */ 163 /* create dvb_frontend */
174 state->frontend.ops = &state->ops; 164 memcpy(&state->frontend.ops, &dvb_dummy_fe_qam_ops, sizeof(struct dvb_frontend_ops));
175 state->frontend.demodulator_priv = state; 165 state->frontend.demodulator_priv = state;
176 return &state->frontend; 166 return &state->frontend;
177 167
diff --git a/drivers/media/dvb/frontends/isl6421.c b/drivers/media/dvb/frontends/isl6421.c
index 36992077aaf0..58c34db31071 100644
--- a/drivers/media/dvb/frontends/isl6421.c
+++ b/drivers/media/dvb/frontends/isl6421.c
@@ -99,11 +99,11 @@ static void isl6421_release(struct dvb_frontend *fe)
99 isl6421_set_voltage(fe, SEC_VOLTAGE_OFF); 99 isl6421_set_voltage(fe, SEC_VOLTAGE_OFF);
100 100
101 /* free data & call next release routine */ 101 /* free data & call next release routine */
102 fe->ops->release = isl6421->release_chain; 102 fe->ops.release = isl6421->release_chain;
103 kfree(fe->misc_priv); 103 kfree(fe->misc_priv);
104 fe->misc_priv = NULL; 104 fe->misc_priv = NULL;
105 if (fe->ops->release) 105 if (fe->ops.release)
106 fe->ops->release(fe); 106 fe->ops.release(fe);
107} 107}
108 108
109int isl6421_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 i2c_addr, 109int isl6421_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 i2c_addr,
@@ -133,12 +133,12 @@ int isl6421_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 i2c_addr
133 } 133 }
134 134
135 /* install release callback */ 135 /* install release callback */
136 isl6421->release_chain = fe->ops->release; 136 isl6421->release_chain = fe->ops.release;
137 fe->ops->release = isl6421_release; 137 fe->ops.release = isl6421_release;
138 138
139 /* override frontend ops */ 139 /* override frontend ops */
140 fe->ops->set_voltage = isl6421_set_voltage; 140 fe->ops.set_voltage = isl6421_set_voltage;
141 fe->ops->enable_high_lnb_voltage = isl6421_enable_high_lnb_voltage; 141 fe->ops.enable_high_lnb_voltage = isl6421_enable_high_lnb_voltage;
142 142
143 return 0; 143 return 0;
144} 144}
diff --git a/drivers/media/dvb/frontends/l64781.c b/drivers/media/dvb/frontends/l64781.c
index fa4a87e0049e..f3bc82e44a28 100644
--- a/drivers/media/dvb/frontends/l64781.c
+++ b/drivers/media/dvb/frontends/l64781.c
@@ -32,7 +32,6 @@
32 32
33struct l64781_state { 33struct l64781_state {
34 struct i2c_adapter* i2c; 34 struct i2c_adapter* i2c;
35 struct dvb_frontend_ops ops;
36 const struct l64781_config* config; 35 const struct l64781_config* config;
37 struct dvb_frontend frontend; 36 struct dvb_frontend frontend;
38 37
@@ -141,9 +140,9 @@ static int apply_frontend_param (struct dvb_frontend* fe, struct dvb_frontend_pa
141 u8 val0x06; 140 u8 val0x06;
142 int bw = p->bandwidth - BANDWIDTH_8_MHZ; 141 int bw = p->bandwidth - BANDWIDTH_8_MHZ;
143 142
144 if (fe->ops->tuner_ops.set_params) { 143 if (fe->ops.tuner_ops.set_params) {
145 fe->ops->tuner_ops.set_params(fe, param); 144 fe->ops.tuner_ops.set_params(fe, param);
146 if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); 145 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
147 } 146 }
148 147
149 if (param->inversion != INVERSION_ON && 148 if (param->inversion != INVERSION_ON &&
@@ -509,7 +508,6 @@ struct dvb_frontend* l64781_attach(const struct l64781_config* config,
509 /* setup the state */ 508 /* setup the state */
510 state->config = config; 509 state->config = config;
511 state->i2c = i2c; 510 state->i2c = i2c;
512 memcpy(&state->ops, &l64781_ops, sizeof(struct dvb_frontend_ops));
513 state->first = 1; 511 state->first = 1;
514 512
515 /** 513 /**
@@ -555,7 +553,7 @@ struct dvb_frontend* l64781_attach(const struct l64781_config* config,
555 } 553 }
556 554
557 /* create dvb_frontend */ 555 /* create dvb_frontend */
558 state->frontend.ops = &state->ops; 556 memcpy(&state->frontend.ops, &l64781_ops, sizeof(struct dvb_frontend_ops));
559 state->frontend.demodulator_priv = state; 557 state->frontend.demodulator_priv = state;
560 return &state->frontend; 558 return &state->frontend;
561 559
diff --git a/drivers/media/dvb/frontends/lg_h06xf.h b/drivers/media/dvb/frontends/lg_h06xf.h
index c59fe4180522..754d51d11120 100644
--- a/drivers/media/dvb/frontends/lg_h06xf.h
+++ b/drivers/media/dvb/frontends/lg_h06xf.h
@@ -29,8 +29,8 @@ static int lg_h06xf_pll_set(struct dvb_frontend* fe, struct i2c_adapter* i2c_ada
29 int err; 29 int err;
30 30
31 dvb_pll_configure(&dvb_pll_lg_tdvs_h06xf, buf, params->frequency, 0); 31 dvb_pll_configure(&dvb_pll_lg_tdvs_h06xf, buf, params->frequency, 0);
32 if (fe->ops->i2c_gate_ctrl) 32 if (fe->ops.i2c_gate_ctrl)
33 fe->ops->i2c_gate_ctrl(fe, 1); 33 fe->ops.i2c_gate_ctrl(fe, 1);
34 if ((err = i2c_transfer(i2c_adap, &msg, 1)) != 1) { 34 if ((err = i2c_transfer(i2c_adap, &msg, 1)) != 1) {
35 printk(KERN_WARNING "lg_h06xf: %s error " 35 printk(KERN_WARNING "lg_h06xf: %s error "
36 "(addr %02x <- %02x, err = %i)\n", 36 "(addr %02x <- %02x, err = %i)\n",
@@ -47,8 +47,8 @@ static int lg_h06xf_pll_set(struct dvb_frontend* fe, struct i2c_adapter* i2c_ada
47 buf[0] |= 0x18; 47 buf[0] |= 0x18;
48 buf[1] = 0x50; 48 buf[1] = 0x50;
49 msg.len = 2; 49 msg.len = 2;
50 if (fe->ops->i2c_gate_ctrl) 50 if (fe->ops.i2c_gate_ctrl)
51 fe->ops->i2c_gate_ctrl(fe, 1); 51 fe->ops.i2c_gate_ctrl(fe, 1);
52 if ((err = i2c_transfer(i2c_adap, &msg, 1)) != 1) { 52 if ((err = i2c_transfer(i2c_adap, &msg, 1)) != 1) {
53 printk(KERN_WARNING "lg_h06xf: %s error " 53 printk(KERN_WARNING "lg_h06xf: %s error "
54 "(addr %02x <- %02x, err = %i)\n", 54 "(addr %02x <- %02x, err = %i)\n",
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:
diff --git a/drivers/media/dvb/frontends/lnbp21.c b/drivers/media/dvb/frontends/lnbp21.c
index c9152c1fbc3f..e933edc8dd29 100644
--- a/drivers/media/dvb/frontends/lnbp21.c
+++ b/drivers/media/dvb/frontends/lnbp21.c
@@ -97,11 +97,11 @@ static void lnbp21_release(struct dvb_frontend *fe)
97 lnbp21_set_voltage(fe, SEC_VOLTAGE_OFF); 97 lnbp21_set_voltage(fe, SEC_VOLTAGE_OFF);
98 98
99 /* free data & call next release routine */ 99 /* free data & call next release routine */
100 fe->ops->release = lnbp21->release_chain; 100 fe->ops.release = lnbp21->release_chain;
101 kfree(fe->misc_priv); 101 kfree(fe->misc_priv);
102 fe->misc_priv = NULL; 102 fe->misc_priv = NULL;
103 if (fe->ops->release) 103 if (fe->ops.release)
104 fe->ops->release(fe); 104 fe->ops.release(fe);
105} 105}
106 106
107int lnbp21_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 override_set, u8 override_clear) 107int lnbp21_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 override_set, u8 override_clear)
@@ -129,12 +129,12 @@ int lnbp21_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 override_
129 } 129 }
130 130
131 /* install release callback */ 131 /* install release callback */
132 lnbp21->release_chain = fe->ops->release; 132 lnbp21->release_chain = fe->ops.release;
133 fe->ops->release = lnbp21_release; 133 fe->ops.release = lnbp21_release;
134 134
135 /* override frontend ops */ 135 /* override frontend ops */
136 fe->ops->set_voltage = lnbp21_set_voltage; 136 fe->ops.set_voltage = lnbp21_set_voltage;
137 fe->ops->enable_high_lnb_voltage = lnbp21_enable_high_lnb_voltage; 137 fe->ops.enable_high_lnb_voltage = lnbp21_enable_high_lnb_voltage;
138 138
139 return 0; 139 return 0;
140} 140}
diff --git a/drivers/media/dvb/frontends/mt312.c b/drivers/media/dvb/frontends/mt312.c
index 46e12a8acf72..1ef821825641 100644
--- a/drivers/media/dvb/frontends/mt312.c
+++ b/drivers/media/dvb/frontends/mt312.c
@@ -39,7 +39,6 @@
39 39
40struct mt312_state { 40struct mt312_state {
41 struct i2c_adapter* i2c; 41 struct i2c_adapter* i2c;
42 struct dvb_frontend_ops ops;
43 /* configuration settings */ 42 /* configuration settings */
44 const struct mt312_config* config; 43 const struct mt312_config* config;
45 struct dvb_frontend frontend; 44 struct dvb_frontend frontend;
@@ -471,16 +470,16 @@ static int mt312_set_frontend(struct dvb_frontend* fe,
471 470
472 dprintk("%s: Freq %d\n", __FUNCTION__, p->frequency); 471 dprintk("%s: Freq %d\n", __FUNCTION__, p->frequency);
473 472
474 if ((p->frequency < fe->ops->info.frequency_min) 473 if ((p->frequency < fe->ops.info.frequency_min)
475 || (p->frequency > fe->ops->info.frequency_max)) 474 || (p->frequency > fe->ops.info.frequency_max))
476 return -EINVAL; 475 return -EINVAL;
477 476
478 if ((p->inversion < INVERSION_OFF) 477 if ((p->inversion < INVERSION_OFF)
479 || (p->inversion > INVERSION_ON)) 478 || (p->inversion > INVERSION_ON))
480 return -EINVAL; 479 return -EINVAL;
481 480
482 if ((p->u.qpsk.symbol_rate < fe->ops->info.symbol_rate_min) 481 if ((p->u.qpsk.symbol_rate < fe->ops.info.symbol_rate_min)
483 || (p->u.qpsk.symbol_rate > fe->ops->info.symbol_rate_max)) 482 || (p->u.qpsk.symbol_rate > fe->ops.info.symbol_rate_max))
484 return -EINVAL; 483 return -EINVAL;
485 484
486 if ((p->u.qpsk.fec_inner < FEC_NONE) 485 if ((p->u.qpsk.fec_inner < FEC_NONE)
@@ -523,9 +522,9 @@ static int mt312_set_frontend(struct dvb_frontend* fe,
523 return -EINVAL; 522 return -EINVAL;
524 } 523 }
525 524
526 if (fe->ops->tuner_ops.set_params) { 525 if (fe->ops.tuner_ops.set_params) {
527 fe->ops->tuner_ops.set_params(fe, p); 526 fe->ops.tuner_ops.set_params(fe, p);
528 if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); 527 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
529 } 528 }
530 529
531 /* sr = (u16)(sr * 256.0 / 1000000.0) */ 530 /* sr = (u16)(sr * 256.0 / 1000000.0) */
@@ -670,19 +669,22 @@ struct dvb_frontend* vp310_mt312_attach(const struct mt312_config* config,
670 /* setup the state */ 669 /* setup the state */
671 state->config = config; 670 state->config = config;
672 state->i2c = i2c; 671 state->i2c = i2c;
673 memcpy(&state->ops, &vp310_mt312_ops, sizeof(struct dvb_frontend_ops));
674 672
675 /* check if the demod is there */ 673 /* check if the demod is there */
676 if (mt312_readreg(state, ID, &state->id) < 0) 674 if (mt312_readreg(state, ID, &state->id) < 0)
677 goto error; 675 goto error;
678 676
677 /* create dvb_frontend */
678 memcpy(&state->frontend.ops, &vp310_mt312_ops, sizeof(struct dvb_frontend_ops));
679 state->frontend.demodulator_priv = state;
680
679 switch (state->id) { 681 switch (state->id) {
680 case ID_VP310: 682 case ID_VP310:
681 strcpy(state->ops.info.name, "Zarlink VP310 DVB-S"); 683 strcpy(state->frontend.ops.info.name, "Zarlink VP310 DVB-S");
682 state->frequency = 90; 684 state->frequency = 90;
683 break; 685 break;
684 case ID_MT312: 686 case ID_MT312:
685 strcpy(state->ops.info.name, "Zarlink MT312 DVB-S"); 687 strcpy(state->frontend.ops.info.name, "Zarlink MT312 DVB-S");
686 state->frequency = 60; 688 state->frequency = 60;
687 break; 689 break;
688 default: 690 default:
@@ -690,9 +692,6 @@ struct dvb_frontend* vp310_mt312_attach(const struct mt312_config* config,
690 goto error; 692 goto error;
691 } 693 }
692 694
693 /* create dvb_frontend */
694 state->frontend.ops = &state->ops;
695 state->frontend.demodulator_priv = state;
696 return &state->frontend; 695 return &state->frontend;
697 696
698error: 697error:
diff --git a/drivers/media/dvb/frontends/mt352.c b/drivers/media/dvb/frontends/mt352.c
index 8601a3f43074..5de7376c94ce 100644
--- a/drivers/media/dvb/frontends/mt352.c
+++ b/drivers/media/dvb/frontends/mt352.c
@@ -45,7 +45,6 @@
45struct mt352_state { 45struct mt352_state {
46 struct i2c_adapter* i2c; 46 struct i2c_adapter* i2c;
47 struct dvb_frontend frontend; 47 struct dvb_frontend frontend;
48 struct dvb_frontend_ops ops;
49 48
50 /* configuration settings */ 49 /* configuration settings */
51 struct mt352_config config; 50 struct mt352_config config;
@@ -288,17 +287,17 @@ static int mt352_set_parameters(struct dvb_frontend* fe,
288 mt352_calc_input_freq(state, buf+6); 287 mt352_calc_input_freq(state, buf+6);
289 288
290 if (state->config.no_tuner) { 289 if (state->config.no_tuner) {
291 if (fe->ops->tuner_ops.set_params) { 290 if (fe->ops.tuner_ops.set_params) {
292 fe->ops->tuner_ops.set_params(fe, param); 291 fe->ops.tuner_ops.set_params(fe, param);
293 if (fe->ops->i2c_gate_ctrl) 292 if (fe->ops.i2c_gate_ctrl)
294 fe->ops->i2c_gate_ctrl(fe, 0); 293 fe->ops.i2c_gate_ctrl(fe, 0);
295 } 294 }
296 295
297 mt352_write(fe, buf, 8); 296 mt352_write(fe, buf, 8);
298 mt352_write(fe, fsm_go, 2); 297 mt352_write(fe, fsm_go, 2);
299 } else { 298 } else {
300 if (fe->ops->tuner_ops.calc_regs) { 299 if (fe->ops.tuner_ops.calc_regs) {
301 fe->ops->tuner_ops.calc_regs(fe, param, buf+8, 5); 300 fe->ops.tuner_ops.calc_regs(fe, param, buf+8, 5);
302 buf[8] <<= 1; 301 buf[8] <<= 1;
303 mt352_write(fe, buf, sizeof(buf)); 302 mt352_write(fe, buf, sizeof(buf));
304 mt352_write(fe, tuner_go, 2); 303 mt352_write(fe, tuner_go, 2);
@@ -550,13 +549,12 @@ struct dvb_frontend* mt352_attach(const struct mt352_config* config,
550 /* setup the state */ 549 /* setup the state */
551 state->i2c = i2c; 550 state->i2c = i2c;
552 memcpy(&state->config,config,sizeof(struct mt352_config)); 551 memcpy(&state->config,config,sizeof(struct mt352_config));
553 memcpy(&state->ops, &mt352_ops, sizeof(struct dvb_frontend_ops));
554 552
555 /* check if the demod is there */ 553 /* check if the demod is there */
556 if (mt352_read_register(state, CHIP_ID) != ID_MT352) goto error; 554 if (mt352_read_register(state, CHIP_ID) != ID_MT352) goto error;
557 555
558 /* create dvb_frontend */ 556 /* create dvb_frontend */
559 state->frontend.ops = &state->ops; 557 memcpy(&state->frontend.ops, &mt352_ops, sizeof(struct dvb_frontend_ops));
560 state->frontend.demodulator_priv = state; 558 state->frontend.demodulator_priv = state;
561 return &state->frontend; 559 return &state->frontend;
562 560
diff --git a/drivers/media/dvb/frontends/nxt200x.c b/drivers/media/dvb/frontends/nxt200x.c
index 9b13f14f14f6..55671cb5255e 100644
--- a/drivers/media/dvb/frontends/nxt200x.c
+++ b/drivers/media/dvb/frontends/nxt200x.c
@@ -55,7 +55,6 @@
55struct nxt200x_state { 55struct nxt200x_state {
56 56
57 struct i2c_adapter* i2c; 57 struct i2c_adapter* i2c;
58 struct dvb_frontend_ops ops;
59 const struct nxt200x_config* config; 58 const struct nxt200x_config* config;
60 struct dvb_frontend frontend; 59 struct dvb_frontend frontend;
61 60
@@ -548,8 +547,8 @@ static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe,
548 } 547 }
549 548
550 /* get tuning information */ 549 /* get tuning information */
551 if (fe->ops->tuner_ops.calc_regs) { 550 if (fe->ops.tuner_ops.calc_regs) {
552 fe->ops->tuner_ops.calc_regs(fe, p, buf, 5); 551 fe->ops.tuner_ops.calc_regs(fe, p, buf, 5);
553 } 552 }
554 553
555 /* set additional params */ 554 /* set additional params */
@@ -1161,7 +1160,6 @@ struct dvb_frontend* nxt200x_attach(const struct nxt200x_config* config,
1161 /* setup the state */ 1160 /* setup the state */
1162 state->config = config; 1161 state->config = config;
1163 state->i2c = i2c; 1162 state->i2c = i2c;
1164 memcpy(&state->ops, &nxt200x_ops, sizeof(struct dvb_frontend_ops));
1165 state->initialised = 0; 1163 state->initialised = 0;
1166 1164
1167 /* read card id */ 1165 /* read card id */
@@ -1200,7 +1198,7 @@ struct dvb_frontend* nxt200x_attach(const struct nxt200x_config* config,
1200 } 1198 }
1201 1199
1202 /* create dvb_frontend */ 1200 /* create dvb_frontend */
1203 state->frontend.ops = &state->ops; 1201 memcpy(&state->frontend.ops, &nxt200x_ops, sizeof(struct dvb_frontend_ops));
1204 state->frontend.demodulator_priv = state; 1202 state->frontend.demodulator_priv = state;
1205 return &state->frontend; 1203 return &state->frontend;
1206 1204
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
34struct nxt6000_state { 34struct 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
diff --git a/drivers/media/dvb/frontends/or51132.c b/drivers/media/dvb/frontends/or51132.c
index 19f75e6ed829..d20ab30c1e83 100644
--- a/drivers/media/dvb/frontends/or51132.c
+++ b/drivers/media/dvb/frontends/or51132.c
@@ -54,7 +54,6 @@ static int debug;
54struct or51132_state 54struct or51132_state
55{ 55{
56 struct i2c_adapter* i2c; 56 struct i2c_adapter* i2c;
57 struct dvb_frontend_ops ops;
58 57
59 /* Configuration settings */ 58 /* Configuration settings */
60 const struct or51132_config* config; 59 const struct or51132_config* config;
@@ -383,9 +382,9 @@ static int or51132_set_parameters(struct dvb_frontend* fe,
383 or51132_setmode(fe); 382 or51132_setmode(fe);
384 } 383 }
385 384
386 if (fe->ops->tuner_ops.set_params) { 385 if (fe->ops.tuner_ops.set_params) {
387 fe->ops->tuner_ops.set_params(fe, param); 386 fe->ops.tuner_ops.set_params(fe, param);
388 if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); 387 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
389 } 388 }
390 389
391 /* Set to current mode */ 390 /* Set to current mode */
@@ -618,12 +617,11 @@ struct dvb_frontend* or51132_attach(const struct or51132_config* config,
618 /* Setup the state */ 617 /* Setup the state */
619 state->config = config; 618 state->config = config;
620 state->i2c = i2c; 619 state->i2c = i2c;
621 memcpy(&state->ops, &or51132_ops, sizeof(struct dvb_frontend_ops));
622 state->current_frequency = -1; 620 state->current_frequency = -1;
623 state->current_modulation = -1; 621 state->current_modulation = -1;
624 622
625 /* Create dvb_frontend */ 623 /* Create dvb_frontend */
626 state->frontend.ops = &state->ops; 624 memcpy(&state->frontend.ops, &or51132_ops, sizeof(struct dvb_frontend_ops));
627 state->frontend.demodulator_priv = state; 625 state->frontend.demodulator_priv = state;
628 return &state->frontend; 626 return &state->frontend;
629 627
@@ -636,7 +634,7 @@ static struct dvb_frontend_ops or51132_ops = {
636 634
637 .info = { 635 .info = {
638 .name = "Oren OR51132 VSB/QAM Frontend", 636 .name = "Oren OR51132 VSB/QAM Frontend",
639 .type = FE_ATSC, 637 .type = FE_ATSC,
640 .frequency_min = 44000000, 638 .frequency_min = 44000000,
641 .frequency_max = 958000000, 639 .frequency_max = 958000000,
642 .frequency_stepsize = 166666, 640 .frequency_stepsize = 166666,
diff --git a/drivers/media/dvb/frontends/or51211.c b/drivers/media/dvb/frontends/or51211.c
index 7c3aed1f546b..26bed616fabe 100644
--- a/drivers/media/dvb/frontends/or51211.c
+++ b/drivers/media/dvb/frontends/or51211.c
@@ -54,7 +54,6 @@ static u8 cmd_buf[] = {0x04,0x01,0x50,0x80,0x06}; // ATSC
54struct or51211_state { 54struct or51211_state {
55 55
56 struct i2c_adapter* i2c; 56 struct i2c_adapter* i2c;
57 struct dvb_frontend_ops ops;
58 57
59 /* Configuration settings */ 58 /* Configuration settings */
60 const struct or51211_config* config; 59 const struct or51211_config* config;
@@ -585,12 +584,11 @@ struct dvb_frontend* or51211_attach(const struct or51211_config* config,
585 /* Setup the state */ 584 /* Setup the state */
586 state->config = config; 585 state->config = config;
587 state->i2c = i2c; 586 state->i2c = i2c;
588 memcpy(&state->ops, &or51211_ops, sizeof(struct dvb_frontend_ops));
589 state->initialized = 0; 587 state->initialized = 0;
590 state->current_frequency = 0; 588 state->current_frequency = 0;
591 589
592 /* Create dvb_frontend */ 590 /* Create dvb_frontend */
593 state->frontend.ops = &state->ops; 591 memcpy(&state->frontend.ops, &or51211_ops, sizeof(struct dvb_frontend_ops));
594 state->frontend.demodulator_priv = state; 592 state->frontend.demodulator_priv = state;
595 return &state->frontend; 593 return &state->frontend;
596 594
diff --git a/drivers/media/dvb/frontends/s5h1420.c b/drivers/media/dvb/frontends/s5h1420.c
index 5dee511544bf..2c2c344c4c64 100644
--- a/drivers/media/dvb/frontends/s5h1420.c
+++ b/drivers/media/dvb/frontends/s5h1420.c
@@ -38,7 +38,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
38 38
39struct s5h1420_state { 39struct s5h1420_state {
40 struct i2c_adapter* i2c; 40 struct i2c_adapter* i2c;
41 struct dvb_frontend_ops ops;
42 const struct s5h1420_config* config; 41 const struct s5h1420_config* config;
43 struct dvb_frontend frontend; 42 struct dvb_frontend frontend;
44 43
@@ -595,14 +594,14 @@ static int s5h1420_set_frontend(struct dvb_frontend* fe,
595 (state->fec_inner == p->u.qpsk.fec_inner) && 594 (state->fec_inner == p->u.qpsk.fec_inner) &&
596 (state->symbol_rate == p->u.qpsk.symbol_rate)) { 595 (state->symbol_rate == p->u.qpsk.symbol_rate)) {
597 596
598 if (fe->ops->tuner_ops.set_params) { 597 if (fe->ops.tuner_ops.set_params) {
599 fe->ops->tuner_ops.set_params(fe, p); 598 fe->ops.tuner_ops.set_params(fe, p);
600 if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); 599 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
601 } 600 }
602 if (fe->ops->tuner_ops.get_frequency) { 601 if (fe->ops.tuner_ops.get_frequency) {
603 u32 tmp; 602 u32 tmp;
604 fe->ops->tuner_ops.get_frequency(fe, &tmp); 603 fe->ops.tuner_ops.get_frequency(fe, &tmp);
605 if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); 604 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
606 s5h1420_setfreqoffset(state, p->frequency - tmp); 605 s5h1420_setfreqoffset(state, p->frequency - tmp);
607 } else { 606 } else {
608 s5h1420_setfreqoffset(state, 0); 607 s5h1420_setfreqoffset(state, 0);
@@ -652,9 +651,9 @@ static int s5h1420_set_frontend(struct dvb_frontend* fe,
652 s5h1420_writereg(state, 0x05, s5h1420_readreg(state, 0x05) | 1); 651 s5h1420_writereg(state, 0x05, s5h1420_readreg(state, 0x05) | 1);
653 652
654 /* set tuner PLL */ 653 /* set tuner PLL */
655 if (fe->ops->tuner_ops.set_params) { 654 if (fe->ops.tuner_ops.set_params) {
656 fe->ops->tuner_ops.set_params(fe, p); 655 fe->ops.tuner_ops.set_params(fe, p);
657 if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); 656 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
658 s5h1420_setfreqoffset(state, 0); 657 s5h1420_setfreqoffset(state, 0);
659 } 658 }
660 659
@@ -766,7 +765,6 @@ struct dvb_frontend* s5h1420_attach(const struct s5h1420_config* config,
766 /* setup the state */ 765 /* setup the state */
767 state->config = config; 766 state->config = config;
768 state->i2c = i2c; 767 state->i2c = i2c;
769 memcpy(&state->ops, &s5h1420_ops, sizeof(struct dvb_frontend_ops));
770 state->postlocked = 0; 768 state->postlocked = 0;
771 state->fclk = 88000000; 769 state->fclk = 88000000;
772 state->tunedfreq = 0; 770 state->tunedfreq = 0;
@@ -779,7 +777,7 @@ struct dvb_frontend* s5h1420_attach(const struct s5h1420_config* config,
779 goto error; 777 goto error;
780 778
781 /* create dvb_frontend */ 779 /* create dvb_frontend */
782 state->frontend.ops = &state->ops; 780 memcpy(&state->frontend.ops, &s5h1420_ops, sizeof(struct dvb_frontend_ops));
783 state->frontend.demodulator_priv = state; 781 state->frontend.demodulator_priv = state;
784 return &state->frontend; 782 return &state->frontend;
785 783
diff --git a/drivers/media/dvb/frontends/sp8870.c b/drivers/media/dvb/frontends/sp8870.c
index 4d553c0dabb3..44ec5b9a4695 100644
--- a/drivers/media/dvb/frontends/sp8870.c
+++ b/drivers/media/dvb/frontends/sp8870.c
@@ -44,8 +44,6 @@ struct sp8870_state {
44 44
45 struct i2c_adapter* i2c; 45 struct i2c_adapter* i2c;
46 46
47 struct dvb_frontend_ops ops;
48
49 const struct sp8870_config* config; 47 const struct sp8870_config* config;
50 48
51 struct dvb_frontend frontend; 49 struct dvb_frontend frontend;
@@ -262,9 +260,9 @@ static int sp8870_set_frontend_parameters (struct dvb_frontend* fe,
262 sp8870_microcontroller_stop(state); 260 sp8870_microcontroller_stop(state);
263 261
264 // set tuner parameters 262 // set tuner parameters
265 if (fe->ops->tuner_ops.set_params) { 263 if (fe->ops.tuner_ops.set_params) {
266 fe->ops->tuner_ops.set_params(fe, p); 264 fe->ops.tuner_ops.set_params(fe, p);
267 if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); 265 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
268 } 266 }
269 267
270 // sample rate correction bit [23..17] 268 // sample rate correction bit [23..17]
@@ -566,14 +564,13 @@ struct dvb_frontend* sp8870_attach(const struct sp8870_config* config,
566 /* setup the state */ 564 /* setup the state */
567 state->config = config; 565 state->config = config;
568 state->i2c = i2c; 566 state->i2c = i2c;
569 memcpy(&state->ops, &sp8870_ops, sizeof(struct dvb_frontend_ops));
570 state->initialised = 0; 567 state->initialised = 0;
571 568
572 /* check if the demod is there */ 569 /* check if the demod is there */
573 if (sp8870_readreg(state, 0x0200) < 0) goto error; 570 if (sp8870_readreg(state, 0x0200) < 0) goto error;
574 571
575 /* create dvb_frontend */ 572 /* create dvb_frontend */
576 state->frontend.ops = &state->ops; 573 memcpy(&state->frontend.ops, &sp8870_ops, sizeof(struct dvb_frontend_ops));
577 state->frontend.demodulator_priv = state; 574 state->frontend.demodulator_priv = state;
578 return &state->frontend; 575 return &state->frontend;
579 576
diff --git a/drivers/media/dvb/frontends/sp887x.c b/drivers/media/dvb/frontends/sp887x.c
index 543dfa145090..b0a2b02f6608 100644
--- a/drivers/media/dvb/frontends/sp887x.c
+++ b/drivers/media/dvb/frontends/sp887x.c
@@ -24,7 +24,6 @@
24 24
25struct sp887x_state { 25struct sp887x_state {
26 struct i2c_adapter* i2c; 26 struct i2c_adapter* i2c;
27 struct dvb_frontend_ops ops;
28 const struct sp887x_config* config; 27 const struct sp887x_config* config;
29 struct dvb_frontend frontend; 28 struct dvb_frontend frontend;
30 29
@@ -353,13 +352,13 @@ static int sp887x_setup_frontend_parameters (struct dvb_frontend* fe,
353 sp887x_microcontroller_stop(state); 352 sp887x_microcontroller_stop(state);
354 353
355 /* setup the PLL */ 354 /* setup the PLL */
356 if (fe->ops->tuner_ops.set_params) { 355 if (fe->ops.tuner_ops.set_params) {
357 fe->ops->tuner_ops.set_params(fe, p); 356 fe->ops.tuner_ops.set_params(fe, p);
358 if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); 357 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
359 } 358 }
360 if (fe->ops->tuner_ops.get_frequency) { 359 if (fe->ops.tuner_ops.get_frequency) {
361 fe->ops->tuner_ops.get_frequency(fe, &actual_freq); 360 fe->ops.tuner_ops.get_frequency(fe, &actual_freq);
362 if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); 361 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
363 } else { 362 } else {
364 actual_freq = p->frequency; 363 actual_freq = p->frequency;
365 } 364 }
@@ -564,14 +563,13 @@ struct dvb_frontend* sp887x_attach(const struct sp887x_config* config,
564 /* setup the state */ 563 /* setup the state */
565 state->config = config; 564 state->config = config;
566 state->i2c = i2c; 565 state->i2c = i2c;
567 memcpy(&state->ops, &sp887x_ops, sizeof(struct dvb_frontend_ops));
568 state->initialised = 0; 566 state->initialised = 0;
569 567
570 /* check if the demod is there */ 568 /* check if the demod is there */
571 if (sp887x_readreg(state, 0x0200) < 0) goto error; 569 if (sp887x_readreg(state, 0x0200) < 0) goto error;
572 570
573 /* create dvb_frontend */ 571 /* create dvb_frontend */
574 state->frontend.ops = &state->ops; 572 memcpy(&state->frontend.ops, &sp887x_ops, sizeof(struct dvb_frontend_ops));
575 state->frontend.demodulator_priv = state; 573 state->frontend.demodulator_priv = state;
576 return &state->frontend; 574 return &state->frontend;
577 575
diff --git a/drivers/media/dvb/frontends/stv0297.c b/drivers/media/dvb/frontends/stv0297.c
index 0d74c2bfc99a..1ca64249010c 100644
--- a/drivers/media/dvb/frontends/stv0297.c
+++ b/drivers/media/dvb/frontends/stv0297.c
@@ -32,7 +32,6 @@
32 32
33struct stv0297_state { 33struct stv0297_state {
34 struct i2c_adapter *i2c; 34 struct i2c_adapter *i2c;
35 struct dvb_frontend_ops ops;
36 const struct stv0297_config *config; 35 const struct stv0297_config *config;
37 struct dvb_frontend frontend; 36 struct dvb_frontend frontend;
38 37
@@ -433,9 +432,9 @@ static int stv0297_set_frontend(struct dvb_frontend *fe, struct dvb_frontend_par
433 } 432 }
434 433
435 stv0297_init(fe); 434 stv0297_init(fe);
436 if (fe->ops->tuner_ops.set_params) { 435 if (fe->ops.tuner_ops.set_params) {
437 fe->ops->tuner_ops.set_params(fe, p); 436 fe->ops.tuner_ops.set_params(fe, p);
438 if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); 437 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
439 } 438 }
440 439
441 /* clear software interrupts */ 440 /* clear software interrupts */
@@ -649,7 +648,6 @@ struct dvb_frontend *stv0297_attach(const struct stv0297_config *config,
649 /* setup the state */ 648 /* setup the state */
650 state->config = config; 649 state->config = config;
651 state->i2c = i2c; 650 state->i2c = i2c;
652 memcpy(&state->ops, &stv0297_ops, sizeof(struct dvb_frontend_ops));
653 state->base_freq = 0; 651 state->base_freq = 0;
654 652
655 /* check if the demod is there */ 653 /* check if the demod is there */
@@ -657,7 +655,7 @@ struct dvb_frontend *stv0297_attach(const struct stv0297_config *config,
657 goto error; 655 goto error;
658 656
659 /* create dvb_frontend */ 657 /* create dvb_frontend */
660 state->frontend.ops = &state->ops; 658 memcpy(&state->frontend.ops, &stv0297_ops, sizeof(struct dvb_frontend_ops));
661 state->frontend.demodulator_priv = state; 659 state->frontend.demodulator_priv = state;
662 return &state->frontend; 660 return &state->frontend;
663 661
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
57struct stv0299_state { 57struct 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
diff --git a/drivers/media/dvb/frontends/tda10021.c b/drivers/media/dvb/frontends/tda10021.c
index c42997917191..e83ff2104c9b 100644
--- a/drivers/media/dvb/frontends/tda10021.c
+++ b/drivers/media/dvb/frontends/tda10021.c
@@ -36,7 +36,6 @@
36 36
37struct tda10021_state { 37struct tda10021_state {
38 struct i2c_adapter* i2c; 38 struct i2c_adapter* i2c;
39 struct dvb_frontend_ops ops;
40 /* configuration settings */ 39 /* configuration settings */
41 const struct tda10021_config* config; 40 const struct tda10021_config* config;
42 struct dvb_frontend frontend; 41 struct dvb_frontend frontend;
@@ -260,9 +259,9 @@ static int tda10021_set_parameters (struct dvb_frontend *fe,
260 259
261 //printk("tda10021: set frequency to %d qam=%d symrate=%d\n", p->frequency,qam,p->u.qam.symbol_rate); 260 //printk("tda10021: set frequency to %d qam=%d symrate=%d\n", p->frequency,qam,p->u.qam.symbol_rate);
262 261
263 if (fe->ops->tuner_ops.set_params) { 262 if (fe->ops.tuner_ops.set_params) {
264 fe->ops->tuner_ops.set_params(fe, p); 263 fe->ops.tuner_ops.set_params(fe, p);
265 if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); 264 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
266 } 265 }
267 266
268 tda10021_set_symbolrate (state, p->u.qam.symbol_rate); 267 tda10021_set_symbolrate (state, p->u.qam.symbol_rate);
@@ -421,7 +420,6 @@ struct dvb_frontend* tda10021_attach(const struct tda10021_config* config,
421 /* setup the state */ 420 /* setup the state */
422 state->config = config; 421 state->config = config;
423 state->i2c = i2c; 422 state->i2c = i2c;
424 memcpy(&state->ops, &tda10021_ops, sizeof(struct dvb_frontend_ops));
425 state->pwm = pwm; 423 state->pwm = pwm;
426 state->reg0 = tda10021_inittab[0]; 424 state->reg0 = tda10021_inittab[0];
427 425
@@ -429,7 +427,7 @@ struct dvb_frontend* tda10021_attach(const struct tda10021_config* config,
429 if ((tda10021_readreg(state, 0x1a) & 0xf0) != 0x70) goto error; 427 if ((tda10021_readreg(state, 0x1a) & 0xf0) != 0x70) goto error;
430 428
431 /* create dvb_frontend */ 429 /* create dvb_frontend */
432 state->frontend.ops = &state->ops; 430 memcpy(&state->frontend.ops, &tda10021_ops, sizeof(struct dvb_frontend_ops));
433 state->frontend.demodulator_priv = state; 431 state->frontend.demodulator_priv = state;
434 return &state->frontend; 432 return &state->frontend;
435 433
diff --git a/drivers/media/dvb/frontends/tda1004x.c b/drivers/media/dvb/frontends/tda1004x.c
index 5288b44cf62c..59a2ed614fca 100644
--- a/drivers/media/dvb/frontends/tda1004x.c
+++ b/drivers/media/dvb/frontends/tda1004x.c
@@ -47,7 +47,6 @@ enum tda1004x_demod {
47 47
48struct tda1004x_state { 48struct tda1004x_state {
49 struct i2c_adapter* i2c; 49 struct i2c_adapter* i2c;
50 struct dvb_frontend_ops ops;
51 const struct tda1004x_config* config; 50 const struct tda1004x_config* config;
52 struct dvb_frontend frontend; 51 struct dvb_frontend frontend;
53 52
@@ -695,9 +694,9 @@ static int tda1004x_set_fe(struct dvb_frontend* fe,
695 } 694 }
696 695
697 // set frequency 696 // set frequency
698 if (fe->ops->tuner_ops.set_params) { 697 if (fe->ops.tuner_ops.set_params) {
699 fe->ops->tuner_ops.set_params(fe, fe_params); 698 fe->ops.tuner_ops.set_params(fe, fe_params);
700 if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); 699 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
701 } 700 }
702 701
703 // Hardcoded to use auto as much as possible on the TDA10045 as it 702 // Hardcoded to use auto as much as possible on the TDA10045 as it
@@ -1243,7 +1242,6 @@ struct dvb_frontend* tda10045_attach(const struct tda1004x_config* config,
1243 /* setup the state */ 1242 /* setup the state */
1244 state->config = config; 1243 state->config = config;
1245 state->i2c = i2c; 1244 state->i2c = i2c;
1246 memcpy(&state->ops, &tda10045_ops, sizeof(struct dvb_frontend_ops));
1247 state->demod_type = TDA1004X_DEMOD_TDA10045; 1245 state->demod_type = TDA1004X_DEMOD_TDA10045;
1248 1246
1249 /* check if the demod is there */ 1247 /* check if the demod is there */
@@ -1253,7 +1251,7 @@ struct dvb_frontend* tda10045_attach(const struct tda1004x_config* config,
1253 } 1251 }
1254 1252
1255 /* create dvb_frontend */ 1253 /* create dvb_frontend */
1256 state->frontend.ops = &state->ops; 1254 memcpy(&state->frontend.ops, &tda10045_ops, sizeof(struct dvb_frontend_ops));
1257 state->frontend.demodulator_priv = state; 1255 state->frontend.demodulator_priv = state;
1258 return &state->frontend; 1256 return &state->frontend;
1259} 1257}
@@ -1302,7 +1300,6 @@ struct dvb_frontend* tda10046_attach(const struct tda1004x_config* config,
1302 /* setup the state */ 1300 /* setup the state */
1303 state->config = config; 1301 state->config = config;
1304 state->i2c = i2c; 1302 state->i2c = i2c;
1305 memcpy(&state->ops, &tda10046_ops, sizeof(struct dvb_frontend_ops));
1306 state->demod_type = TDA1004X_DEMOD_TDA10046; 1303 state->demod_type = TDA1004X_DEMOD_TDA10046;
1307 1304
1308 /* check if the demod is there */ 1305 /* check if the demod is there */
@@ -1312,7 +1309,7 @@ struct dvb_frontend* tda10046_attach(const struct tda1004x_config* config,
1312 } 1309 }
1313 1310
1314 /* create dvb_frontend */ 1311 /* create dvb_frontend */
1315 state->frontend.ops = &state->ops; 1312 memcpy(&state->frontend.ops, &tda10046_ops, sizeof(struct dvb_frontend_ops));
1316 state->frontend.demodulator_priv = state; 1313 state->frontend.demodulator_priv = state;
1317 return &state->frontend; 1314 return &state->frontend;
1318} 1315}
diff --git a/drivers/media/dvb/frontends/tda8083.c b/drivers/media/dvb/frontends/tda8083.c
index 0aeaec890296..3aa45ebbac3d 100644
--- a/drivers/media/dvb/frontends/tda8083.c
+++ b/drivers/media/dvb/frontends/tda8083.c
@@ -37,7 +37,6 @@
37 37
38struct tda8083_state { 38struct tda8083_state {
39 struct i2c_adapter* i2c; 39 struct i2c_adapter* i2c;
40 struct dvb_frontend_ops ops;
41 /* configuration settings */ 40 /* configuration settings */
42 const struct tda8083_config* config; 41 const struct tda8083_config* config;
43 struct dvb_frontend frontend; 42 struct dvb_frontend frontend;
@@ -293,9 +292,9 @@ static int tda8083_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par
293{ 292{
294 struct tda8083_state* state = fe->demodulator_priv; 293 struct tda8083_state* state = fe->demodulator_priv;
295 294
296 if (fe->ops->tuner_ops.set_params) { 295 if (fe->ops.tuner_ops.set_params) {
297 fe->ops->tuner_ops.set_params(fe, p); 296 fe->ops.tuner_ops.set_params(fe, p);
298 if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); 297 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
299 } 298 }
300 299
301 tda8083_set_inversion (state, p->inversion); 300 tda8083_set_inversion (state, p->inversion);
@@ -397,13 +396,12 @@ struct dvb_frontend* tda8083_attach(const struct tda8083_config* config,
397 /* setup the state */ 396 /* setup the state */
398 state->config = config; 397 state->config = config;
399 state->i2c = i2c; 398 state->i2c = i2c;
400 memcpy(&state->ops, &tda8083_ops, sizeof(struct dvb_frontend_ops));
401 399
402 /* check if the demod is there */ 400 /* check if the demod is there */
403 if ((tda8083_readreg(state, 0x00)) != 0x05) goto error; 401 if ((tda8083_readreg(state, 0x00)) != 0x05) goto error;
404 402
405 /* create dvb_frontend */ 403 /* create dvb_frontend */
406 state->frontend.ops = &state->ops; 404 memcpy(&state->frontend.ops, &tda8083_ops, sizeof(struct dvb_frontend_ops));
407 state->frontend.demodulator_priv = state; 405 state->frontend.demodulator_priv = state;
408 return &state->frontend; 406 return &state->frontend;
409 407
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
36struct ves1820_state { 36struct 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
405error: 403error:
diff --git a/drivers/media/dvb/frontends/ves1x93.c b/drivers/media/dvb/frontends/ves1x93.c
index 660aa7bb90d0..54d7b07571b8 100644
--- a/drivers/media/dvb/frontends/ves1x93.c
+++ b/drivers/media/dvb/frontends/ves1x93.c
@@ -36,7 +36,6 @@
36 36
37struct ves1x93_state { 37struct ves1x93_state {
38 struct i2c_adapter* i2c; 38 struct i2c_adapter* i2c;
39 struct dvb_frontend_ops ops;
40 /* configuration settings */ 39 /* configuration settings */
41 const struct ves1x93_config* config; 40 const struct ves1x93_config* config;
42 struct dvb_frontend frontend; 41 struct dvb_frontend frontend;
@@ -389,9 +388,9 @@ static int ves1x93_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par
389{ 388{
390 struct ves1x93_state* state = fe->demodulator_priv; 389 struct ves1x93_state* state = fe->demodulator_priv;
391 390
392 if (fe->ops->tuner_ops.set_params) { 391 if (fe->ops.tuner_ops.set_params) {
393 fe->ops->tuner_ops.set_params(fe, p); 392 fe->ops.tuner_ops.set_params(fe, p);
394 if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); 393 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
395 } 394 }
396 ves1x93_set_inversion (state, p->inversion); 395 ves1x93_set_inversion (state, p->inversion);
397 ves1x93_set_fec (state, p->u.qpsk.fec_inner); 396 ves1x93_set_fec (state, p->u.qpsk.fec_inner);
@@ -463,7 +462,6 @@ struct dvb_frontend* ves1x93_attach(const struct ves1x93_config* config,
463 /* setup the state */ 462 /* setup the state */
464 state->config = config; 463 state->config = config;
465 state->i2c = i2c; 464 state->i2c = i2c;
466 memcpy(&state->ops, &ves1x93_ops, sizeof(struct dvb_frontend_ops));
467 state->inversion = INVERSION_OFF; 465 state->inversion = INVERSION_OFF;
468 466
469 /* check if the demod is there + identify it */ 467 /* check if the demod is there + identify it */
@@ -498,7 +496,7 @@ struct dvb_frontend* ves1x93_attach(const struct ves1x93_config* config,
498 } 496 }
499 497
500 /* create dvb_frontend */ 498 /* create dvb_frontend */
501 state->frontend.ops = &state->ops; 499 memcpy(&state->frontend.ops, &ves1x93_ops, sizeof(struct dvb_frontend_ops));
502 state->frontend.demodulator_priv = state; 500 state->frontend.demodulator_priv = state;
503 return &state->frontend; 501 return &state->frontend;
504 502
diff --git a/drivers/media/dvb/frontends/zl10353.c b/drivers/media/dvb/frontends/zl10353.c
index ac39f5519621..2b95e8b6cd39 100644
--- a/drivers/media/dvb/frontends/zl10353.c
+++ b/drivers/media/dvb/frontends/zl10353.c
@@ -34,7 +34,6 @@
34struct zl10353_state { 34struct zl10353_state {
35 struct i2c_adapter *i2c; 35 struct i2c_adapter *i2c;
36 struct dvb_frontend frontend; 36 struct dvb_frontend frontend;
37 struct dvb_frontend_ops ops;
38 37
39 struct zl10353_config config; 38 struct zl10353_config config;
40}; 39};
@@ -146,15 +145,15 @@ static int zl10353_set_parameters(struct dvb_frontend *fe,
146 // if there is no attached secondary tuner, we call set_params to program 145 // if there is no attached secondary tuner, we call set_params to program
147 // a potential tuner attached somewhere else 146 // a potential tuner attached somewhere else
148 if (state->config.no_tuner) { 147 if (state->config.no_tuner) {
149 if (fe->ops->tuner_ops.set_params) { 148 if (fe->ops.tuner_ops.set_params) {
150 fe->ops->tuner_ops.set_params(fe, param); 149 fe->ops.tuner_ops.set_params(fe, param);
151 if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); 150 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
152 } 151 }
153 } 152 }
154 153
155 // if pllbuf is defined, retrieve the settings 154 // if pllbuf is defined, retrieve the settings
156 if (fe->ops->tuner_ops.calc_regs) { 155 if (fe->ops.tuner_ops.calc_regs) {
157 fe->ops->tuner_ops.calc_regs(fe, param, pllbuf+1, 5); 156 fe->ops.tuner_ops.calc_regs(fe, param, pllbuf+1, 5);
158 pllbuf[1] <<= 1; 157 pllbuf[1] <<= 1;
159 } else { 158 } else {
160 // fake pllbuf settings 159 // fake pllbuf settings
@@ -278,14 +277,13 @@ struct dvb_frontend *zl10353_attach(const struct zl10353_config *config,
278 /* setup the state */ 277 /* setup the state */
279 state->i2c = i2c; 278 state->i2c = i2c;
280 memcpy(&state->config, config, sizeof(struct zl10353_config)); 279 memcpy(&state->config, config, sizeof(struct zl10353_config));
281 memcpy(&state->ops, &zl10353_ops, sizeof(struct dvb_frontend_ops));
282 280
283 /* check if the demod is there */ 281 /* check if the demod is there */
284 if (zl10353_read_register(state, CHIP_ID) != ID_ZL10353) 282 if (zl10353_read_register(state, CHIP_ID) != ID_ZL10353)
285 goto error; 283 goto error;
286 284
287 /* create dvb_frontend */ 285 /* create dvb_frontend */
288 state->frontend.ops = &state->ops; 286 memcpy(&state->frontend.ops, &zl10353_ops, sizeof(struct dvb_frontend_ops));
289 state->frontend.demodulator_priv = state; 287 state->frontend.demodulator_priv = state;
290 288
291 return &state->frontend; 289 return &state->frontend;