aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/tda8290.c
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2007-12-21 09:18:32 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-01-25 16:04:11 -0500
commitbc3e5c7fc20d3c09667067878fb7a55dd9fc041d (patch)
tree81d83ec2aa0b21f8b594d45a398bdefe206ad3e3 /drivers/media/video/tda8290.c
parent9ad89f0104314786138d580ab2c1119e7e470f56 (diff)
V4L/DVB (6881): include struct analog_demod_ops directly inside struct dvb_frontend
Rather than using a pointer, include struct analog_demod_ops directly inside struct dvb_frontend. This will allow us to use dvb_attach in the future, along with removing the need to check the ops structure before having to check the pointer to the method being called. Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/tda8290.c')
-rw-r--r--drivers/media/video/tda8290.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c
index 71d38ba37f2e..2e1d9b663a91 100644
--- a/drivers/media/video/tda8290.c
+++ b/drivers/media/video/tda8290.c
@@ -512,16 +512,16 @@ static void tda829x_release(struct dvb_frontend *fe)
512static int tda829x_find_tuner(struct dvb_frontend *fe) 512static int tda829x_find_tuner(struct dvb_frontend *fe)
513{ 513{
514 struct tda8290_priv *priv = fe->analog_demod_priv; 514 struct tda8290_priv *priv = fe->analog_demod_priv;
515 struct analog_tuner_ops *ops = fe->ops.analog_demod_ops; 515 struct analog_demod_ops *analog_ops = &fe->ops.analog_ops;
516 int i, ret, tuners_found; 516 int i, ret, tuners_found;
517 u32 tuner_addrs; 517 u32 tuner_addrs;
518 u8 data; 518 u8 data;
519 struct i2c_msg msg = { .flags = I2C_M_RD, .buf = &data, .len = 1 }; 519 struct i2c_msg msg = { .flags = I2C_M_RD, .buf = &data, .len = 1 };
520 520
521 if (NULL == ops) 521 if (NULL == analog_ops->i2c_gate_ctrl)
522 return -EINVAL; 522 return -EINVAL;
523 523
524 ops->i2c_gate_ctrl(fe, 1); 524 analog_ops->i2c_gate_ctrl(fe, 1);
525 525
526 /* probe for tuner chip */ 526 /* probe for tuner chip */
527 tuners_found = 0; 527 tuners_found = 0;
@@ -539,7 +539,7 @@ static int tda829x_find_tuner(struct dvb_frontend *fe)
539 give a response now 539 give a response now
540 */ 540 */
541 541
542 ops->i2c_gate_ctrl(fe, 0); 542 analog_ops->i2c_gate_ctrl(fe, 0);
543 543
544 if (tuners_found > 1) 544 if (tuners_found > 1)
545 for (i = 0; i < tuners_found; i++) { 545 for (i = 0; i < tuners_found; i++) {
@@ -562,7 +562,7 @@ static int tda829x_find_tuner(struct dvb_frontend *fe)
562 priv->tda827x_addr = tuner_addrs; 562 priv->tda827x_addr = tuner_addrs;
563 msg.addr = tuner_addrs; 563 msg.addr = tuner_addrs;
564 564
565 ops->i2c_gate_ctrl(fe, 1); 565 analog_ops->i2c_gate_ctrl(fe, 1);
566 ret = i2c_transfer(priv->i2c_props.adap, &msg, 1); 566 ret = i2c_transfer(priv->i2c_props.adap, &msg, 1);
567 567
568 if (ret != 1) { 568 if (ret != 1) {
@@ -590,7 +590,7 @@ static int tda829x_find_tuner(struct dvb_frontend *fe)
590 if (fe->ops.tuner_ops.sleep) 590 if (fe->ops.tuner_ops.sleep)
591 fe->ops.tuner_ops.sleep(fe); 591 fe->ops.tuner_ops.sleep(fe);
592 592
593 ops->i2c_gate_ctrl(fe, 0); 593 analog_ops->i2c_gate_ctrl(fe, 0);
594 594
595 return 0; 595 return 0;
596} 596}
@@ -635,7 +635,7 @@ static int tda8295_probe(struct tuner_i2c_props *i2c_props)
635 return -ENODEV; 635 return -ENODEV;
636} 636}
637 637
638static struct analog_tuner_ops tda8290_tuner_ops = { 638static struct analog_demod_ops tda8290_ops = {
639 .info = { 639 .info = {
640 .name = "TDA8290", 640 .name = "TDA8290",
641 }, 641 },
@@ -646,7 +646,7 @@ static struct analog_tuner_ops tda8290_tuner_ops = {
646 .i2c_gate_ctrl = tda8290_i2c_bridge, 646 .i2c_gate_ctrl = tda8290_i2c_bridge,
647}; 647};
648 648
649static struct analog_tuner_ops tda8295_tuner_ops = { 649static struct analog_demod_ops tda8295_ops = {
650 .info = { 650 .info = {
651 .name = "TDA8295", 651 .name = "TDA8295",
652 }, 652 },
@@ -678,12 +678,14 @@ struct dvb_frontend *tda829x_attach(struct dvb_frontend *fe,
678 678
679 if (tda8290_probe(&priv->i2c_props) == 0) { 679 if (tda8290_probe(&priv->i2c_props) == 0) {
680 priv->ver = TDA8290; 680 priv->ver = TDA8290;
681 fe->ops.analog_demod_ops = &tda8290_tuner_ops; 681 memcpy(&fe->ops.analog_ops, &tda8290_ops,
682 sizeof(struct analog_demod_ops));
682 } 683 }
683 684
684 if (tda8295_probe(&priv->i2c_props) == 0) { 685 if (tda8295_probe(&priv->i2c_props) == 0) {
685 priv->ver = TDA8295; 686 priv->ver = TDA8295;
686 fe->ops.analog_demod_ops = &tda8295_tuner_ops; 687 memcpy(&fe->ops.analog_ops, &tda8295_ops,
688 sizeof(struct analog_demod_ops));
687 } 689 }
688 690
689 if (tda829x_find_tuner(fe) < 0) 691 if (tda829x_find_tuner(fe) < 0)
@@ -723,7 +725,6 @@ struct dvb_frontend *tda829x_attach(struct dvb_frontend *fe,
723 725
724fail: 726fail:
725 tda829x_release(fe); 727 tda829x_release(fe);
726 fe->ops.analog_demod_ops = NULL;
727 return NULL; 728 return NULL;
728} 729}
729EXPORT_SYMBOL_GPL(tda829x_attach); 730EXPORT_SYMBOL_GPL(tda829x_attach);