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/video/cx88 | |
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/video/cx88')
-rw-r--r-- | drivers/media/video/cx88/cx88-dvb.c | 36 | ||||
-rw-r--r-- | drivers/media/video/cx88/cx88-i2c.c | 8 |
2 files changed, 22 insertions, 22 deletions
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index 4d369f8393d9..bf89cbf2b058 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c | |||
@@ -230,8 +230,8 @@ static int philips_fmd1216_pll_init(struct dvb_frontend *fe) | |||
230 | .buf = fmd1216_init, .len = sizeof(fmd1216_init) }; | 230 | .buf = fmd1216_init, .len = sizeof(fmd1216_init) }; |
231 | int err; | 231 | int err; |
232 | 232 | ||
233 | if (fe->ops->i2c_gate_ctrl) | 233 | if (fe->ops.i2c_gate_ctrl) |
234 | fe->ops->i2c_gate_ctrl(fe, 1); | 234 | fe->ops.i2c_gate_ctrl(fe, 1); |
235 | if ((err = i2c_transfer(&dev->core->i2c_adap, &msg, 1)) != 1) { | 235 | if ((err = i2c_transfer(&dev->core->i2c_adap, &msg, 1)) != 1) { |
236 | if (err < 0) | 236 | if (err < 0) |
237 | return err; | 237 | return err; |
@@ -261,8 +261,8 @@ static int dntv_live_dvbt_pro_tuner_set_params(struct dvb_frontend* fe, | |||
261 | dvb_pll_configure(dev->core->pll_desc, buf, | 261 | dvb_pll_configure(dev->core->pll_desc, buf, |
262 | params->frequency, | 262 | params->frequency, |
263 | params->u.ofdm.bandwidth); | 263 | params->u.ofdm.bandwidth); |
264 | if (fe->ops->i2c_gate_ctrl) | 264 | if (fe->ops.i2c_gate_ctrl) |
265 | fe->ops->i2c_gate_ctrl(fe, 1); | 265 | fe->ops.i2c_gate_ctrl(fe, 1); |
266 | if ((err = i2c_transfer(&dev->core->i2c_adap, &msg, 1)) != 1) { | 266 | if ((err = i2c_transfer(&dev->core->i2c_adap, &msg, 1)) != 1) { |
267 | 267 | ||
268 | printk(KERN_WARNING "cx88-dvb: %s error " | 268 | printk(KERN_WARNING "cx88-dvb: %s error " |
@@ -300,8 +300,8 @@ static int dvico_hybrid_tuner_set_params(struct dvb_frontend *fe, | |||
300 | params->frequency, | 300 | params->frequency, |
301 | params->u.ofdm.bandwidth); | 301 | params->u.ofdm.bandwidth); |
302 | 302 | ||
303 | if (fe->ops->i2c_gate_ctrl) | 303 | if (fe->ops.i2c_gate_ctrl) |
304 | fe->ops->i2c_gate_ctrl(fe, 1); | 304 | fe->ops.i2c_gate_ctrl(fe, 1); |
305 | if ((err = i2c_transfer(&dev->core->i2c_adap, &msg, 1)) != 1) { | 305 | if ((err = i2c_transfer(&dev->core->i2c_adap, &msg, 1)) != 1) { |
306 | printk(KERN_WARNING "cx88-dvb: %s error " | 306 | printk(KERN_WARNING "cx88-dvb: %s error " |
307 | "(addr %02x <- %02x, err = %i)\n", | 307 | "(addr %02x <- %02x, err = %i)\n", |
@@ -375,8 +375,8 @@ static int lgdt3302_tuner_set_params(struct dvb_frontend* fe, | |||
375 | dprintk(1, "%s: tuner at 0x%02x bytes: 0x%02x 0x%02x 0x%02x 0x%02x\n", | 375 | dprintk(1, "%s: tuner at 0x%02x bytes: 0x%02x 0x%02x 0x%02x 0x%02x\n", |
376 | __FUNCTION__, msg.addr, buf[0],buf[1],buf[2],buf[3]); | 376 | __FUNCTION__, msg.addr, buf[0],buf[1],buf[2],buf[3]); |
377 | 377 | ||
378 | if (fe->ops->i2c_gate_ctrl) | 378 | if (fe->ops.i2c_gate_ctrl) |
379 | fe->ops->i2c_gate_ctrl(fe, 1); | 379 | fe->ops.i2c_gate_ctrl(fe, 1); |
380 | if ((err = i2c_transfer(&core->i2c_adap, &msg, 1)) != 1) { | 380 | if ((err = i2c_transfer(&core->i2c_adap, &msg, 1)) != 1) { |
381 | printk(KERN_WARNING "cx88-dvb: %s error " | 381 | printk(KERN_WARNING "cx88-dvb: %s error " |
382 | "(addr %02x <- %02x, err = %i)\n", | 382 | "(addr %02x <- %02x, err = %i)\n", |
@@ -586,7 +586,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
586 | dev->dvb.frontend = mt352_attach(&dntv_live_dvbt_pro_config, | 586 | dev->dvb.frontend = mt352_attach(&dntv_live_dvbt_pro_config, |
587 | &((struct vp3054_i2c_state *)dev->card_priv)->adap); | 587 | &((struct vp3054_i2c_state *)dev->card_priv)->adap); |
588 | if (dev->dvb.frontend != NULL) { | 588 | if (dev->dvb.frontend != NULL) { |
589 | dev->dvb.frontend->ops->tuner_ops.set_params = dntv_live_dvbt_pro_tuner_set_params; | 589 | dev->dvb.frontend->ops.tuner_ops.set_params = dntv_live_dvbt_pro_tuner_set_params; |
590 | } | 590 | } |
591 | #else | 591 | #else |
592 | printk("%s: built without vp3054 support\n", dev->core->name); | 592 | printk("%s: built without vp3054 support\n", dev->core->name); |
@@ -609,7 +609,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
609 | dev->dvb.frontend = zl10353_attach(&dvico_fusionhdtv_hybrid, | 609 | dev->dvb.frontend = zl10353_attach(&dvico_fusionhdtv_hybrid, |
610 | &dev->core->i2c_adap); | 610 | &dev->core->i2c_adap); |
611 | if (dev->dvb.frontend != NULL) { | 611 | if (dev->dvb.frontend != NULL) { |
612 | dev->dvb.frontend->ops->tuner_ops.set_params = dvico_hybrid_tuner_set_params; | 612 | dev->dvb.frontend->ops.tuner_ops.set_params = dvico_hybrid_tuner_set_params; |
613 | } | 613 | } |
614 | break; | 614 | break; |
615 | #endif | 615 | #endif |
@@ -641,7 +641,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
641 | dev->dvb.frontend = lgdt330x_attach(&fusionhdtv_3_gold, | 641 | dev->dvb.frontend = lgdt330x_attach(&fusionhdtv_3_gold, |
642 | &dev->core->i2c_adap); | 642 | &dev->core->i2c_adap); |
643 | if (dev->dvb.frontend != NULL) { | 643 | if (dev->dvb.frontend != NULL) { |
644 | dev->dvb.frontend->ops->tuner_ops.set_params = lgdt3302_tuner_set_params; | 644 | dev->dvb.frontend->ops.tuner_ops.set_params = lgdt3302_tuner_set_params; |
645 | } | 645 | } |
646 | } | 646 | } |
647 | break; | 647 | break; |
@@ -660,7 +660,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
660 | dev->dvb.frontend = lgdt330x_attach(&fusionhdtv_3_gold, | 660 | dev->dvb.frontend = lgdt330x_attach(&fusionhdtv_3_gold, |
661 | &dev->core->i2c_adap); | 661 | &dev->core->i2c_adap); |
662 | if (dev->dvb.frontend != NULL) { | 662 | if (dev->dvb.frontend != NULL) { |
663 | dev->dvb.frontend->ops->tuner_ops.set_params = lgdt3302_tuner_set_params; | 663 | dev->dvb.frontend->ops.tuner_ops.set_params = lgdt3302_tuner_set_params; |
664 | } | 664 | } |
665 | } | 665 | } |
666 | break; | 666 | break; |
@@ -677,7 +677,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
677 | dev->dvb.frontend = lgdt330x_attach(&fusionhdtv_5_gold, | 677 | dev->dvb.frontend = lgdt330x_attach(&fusionhdtv_5_gold, |
678 | &dev->core->i2c_adap); | 678 | &dev->core->i2c_adap); |
679 | if (dev->dvb.frontend != NULL) { | 679 | if (dev->dvb.frontend != NULL) { |
680 | dev->dvb.frontend->ops->tuner_ops.set_params = lgdt3303_tuner_set_params; | 680 | dev->dvb.frontend->ops.tuner_ops.set_params = lgdt3303_tuner_set_params; |
681 | } | 681 | } |
682 | } | 682 | } |
683 | break; | 683 | break; |
@@ -694,7 +694,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
694 | dev->dvb.frontend = lgdt330x_attach(&pchdtv_hd5500, | 694 | dev->dvb.frontend = lgdt330x_attach(&pchdtv_hd5500, |
695 | &dev->core->i2c_adap); | 695 | &dev->core->i2c_adap); |
696 | if (dev->dvb.frontend != NULL) { | 696 | if (dev->dvb.frontend != NULL) { |
697 | dev->dvb.frontend->ops->tuner_ops.set_params = lgdt3303_tuner_set_params; | 697 | dev->dvb.frontend->ops.tuner_ops.set_params = lgdt3303_tuner_set_params; |
698 | } | 698 | } |
699 | } | 699 | } |
700 | break; | 700 | break; |
@@ -721,8 +721,8 @@ static int dvb_register(struct cx8802_dev *dev) | |||
721 | dev->dvb.frontend = cx24123_attach(&kworld_dvbs_100_config, | 721 | dev->dvb.frontend = cx24123_attach(&kworld_dvbs_100_config, |
722 | &dev->core->i2c_adap); | 722 | &dev->core->i2c_adap); |
723 | if (dev->dvb.frontend) { | 723 | if (dev->dvb.frontend) { |
724 | dev->core->prev_set_voltage = dev->dvb.frontend->ops->set_voltage; | 724 | dev->core->prev_set_voltage = dev->dvb.frontend->ops.set_voltage; |
725 | dev->dvb.frontend->ops->set_voltage = kworld_dvbs_100_set_voltage; | 725 | dev->dvb.frontend->ops.set_voltage = kworld_dvbs_100_set_voltage; |
726 | } | 726 | } |
727 | break; | 727 | break; |
728 | #endif | 728 | #endif |
@@ -737,8 +737,8 @@ static int dvb_register(struct cx8802_dev *dev) | |||
737 | } | 737 | } |
738 | 738 | ||
739 | if (dev->core->pll_desc) { | 739 | if (dev->core->pll_desc) { |
740 | dev->dvb.frontend->ops->info.frequency_min = dev->core->pll_desc->min; | 740 | dev->dvb.frontend->ops.info.frequency_min = dev->core->pll_desc->min; |
741 | dev->dvb.frontend->ops->info.frequency_max = dev->core->pll_desc->max; | 741 | dev->dvb.frontend->ops.info.frequency_max = dev->core->pll_desc->max; |
742 | } | 742 | } |
743 | 743 | ||
744 | /* Put the analog decoder in standby to keep it quiet */ | 744 | /* Put the analog decoder in standby to keep it quiet */ |
diff --git a/drivers/media/video/cx88/cx88-i2c.c b/drivers/media/video/cx88/cx88-i2c.c index f720901e9638..7efa6def0bde 100644 --- a/drivers/media/video/cx88/cx88-i2c.c +++ b/drivers/media/video/cx88/cx88-i2c.c | |||
@@ -138,13 +138,13 @@ void cx88_call_i2c_clients(struct cx88_core *core, unsigned int cmd, void *arg) | |||
138 | return; | 138 | return; |
139 | 139 | ||
140 | if (core->dvbdev) { | 140 | if (core->dvbdev) { |
141 | if (core->dvbdev->dvb.frontend->ops->i2c_gate_ctrl) | 141 | if (core->dvbdev->dvb.frontend->ops.i2c_gate_ctrl) |
142 | core->dvbdev->dvb.frontend->ops->i2c_gate_ctrl(core->dvbdev->dvb.frontend, 1); | 142 | core->dvbdev->dvb.frontend->ops.i2c_gate_ctrl(core->dvbdev->dvb.frontend, 1); |
143 | 143 | ||
144 | i2c_clients_command(&core->i2c_adap, cmd, arg); | 144 | i2c_clients_command(&core->i2c_adap, cmd, arg); |
145 | 145 | ||
146 | if (core->dvbdev->dvb.frontend->ops->i2c_gate_ctrl) | 146 | if (core->dvbdev->dvb.frontend->ops.i2c_gate_ctrl) |
147 | core->dvbdev->dvb.frontend->ops->i2c_gate_ctrl(core->dvbdev->dvb.frontend, 0); | 147 | core->dvbdev->dvb.frontend->ops.i2c_gate_ctrl(core->dvbdev->dvb.frontend, 0); |
148 | } else | 148 | } else |
149 | i2c_clients_command(&core->i2c_adap, cmd, arg); | 149 | i2c_clients_command(&core->i2c_adap, cmd, arg); |
150 | } | 150 | } |