diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2007-06-06 15:10:39 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-07-18 13:24:02 -0400 |
commit | 7a91a80a0d1a0a83a94e773ec6245b31b7c4ceed (patch) | |
tree | d524d57405944826d4a6c375af1a77bab22546a2 /drivers/media/video | |
parent | 018ec5440b4994f560cdde78be6fb10d7ab370d7 (diff) |
V4L/DVB (5753): Tuner: create struct tuner_operations
Move tuner callback function pointers out of struct tuner, into
struct tuner_operations.
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video')
-rw-r--r-- | drivers/media/video/mt20xx.c | 16 | ||||
-rw-r--r-- | drivers/media/video/tda8290.c | 10 | ||||
-rw-r--r-- | drivers/media/video/tda9887.c | 12 | ||||
-rw-r--r-- | drivers/media/video/tea5761.c | 8 | ||||
-rw-r--r-- | drivers/media/video/tea5767.c | 10 | ||||
-rw-r--r-- | drivers/media/video/tuner-core.c | 62 | ||||
-rw-r--r-- | drivers/media/video/tuner-simple.c | 10 |
7 files changed, 64 insertions, 64 deletions
diff --git a/drivers/media/video/mt20xx.c b/drivers/media/video/mt20xx.c index 5b33be8a49cd..846c6233fa3d 100644 --- a/drivers/media/video/mt20xx.c +++ b/drivers/media/video/mt20xx.c | |||
@@ -361,8 +361,8 @@ static int mt2032_init(struct i2c_client *c) | |||
361 | } while (xok != 1 ); | 361 | } while (xok != 1 ); |
362 | priv->xogc=xogc; | 362 | priv->xogc=xogc; |
363 | 363 | ||
364 | t->set_tv_freq = mt2032_set_tv_freq; | 364 | t->ops.set_tv_freq = mt2032_set_tv_freq; |
365 | t->set_radio_freq = mt2032_set_radio_freq; | 365 | t->ops.set_radio_freq = mt2032_set_radio_freq; |
366 | return(1); | 366 | return(1); |
367 | } | 367 | } |
368 | 368 | ||
@@ -490,8 +490,8 @@ static int mt2050_init(struct i2c_client *c) | |||
490 | i2c_master_recv(c,buf,1); | 490 | i2c_master_recv(c,buf,1); |
491 | 491 | ||
492 | tuner_dbg("mt2050: sro is %x\n",buf[0]); | 492 | tuner_dbg("mt2050: sro is %x\n",buf[0]); |
493 | t->set_tv_freq = mt2050_set_tv_freq; | 493 | t->ops.set_tv_freq = mt2050_set_tv_freq; |
494 | t->set_radio_freq = mt2050_set_radio_freq; | 494 | t->ops.set_radio_freq = mt2050_set_radio_freq; |
495 | return 0; | 495 | return 0; |
496 | } | 496 | } |
497 | 497 | ||
@@ -519,10 +519,10 @@ int microtune_init(struct i2c_client *c) | |||
519 | priv->radio_if2 = 10700 * 1000; /* 10.7MHz - FM radio */ | 519 | priv->radio_if2 = 10700 * 1000; /* 10.7MHz - FM radio */ |
520 | 520 | ||
521 | memset(buf,0,sizeof(buf)); | 521 | memset(buf,0,sizeof(buf)); |
522 | t->set_tv_freq = NULL; | 522 | t->ops.set_tv_freq = NULL; |
523 | t->set_radio_freq = NULL; | 523 | t->ops.set_radio_freq = NULL; |
524 | t->standby = NULL; | 524 | t->ops.standby = NULL; |
525 | t->release = microtune_release; | 525 | t->ops.release = microtune_release; |
526 | if (t->std & V4L2_STD_525_60) { | 526 | if (t->std & V4L2_STD_525_60) { |
527 | tuner_dbg("pinnacle ntsc\n"); | 527 | tuner_dbg("pinnacle ntsc\n"); |
528 | priv->radio_if2 = 41300 * 1000; | 528 | priv->radio_if2 = 41300 * 1000; |
diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c index 2614ea99a9c3..99122ff4e81c 100644 --- a/drivers/media/video/tda8290.c +++ b/drivers/media/video/tda8290.c | |||
@@ -667,11 +667,11 @@ int tda8290_init(struct i2c_client *c) | |||
667 | } | 667 | } |
668 | tuner_info("type set to %s\n", c->name); | 668 | tuner_info("type set to %s\n", c->name); |
669 | 669 | ||
670 | t->set_tv_freq = set_tv_freq; | 670 | t->ops.set_tv_freq = set_tv_freq; |
671 | t->set_radio_freq = set_radio_freq; | 671 | t->ops.set_radio_freq = set_radio_freq; |
672 | t->has_signal = has_signal; | 672 | t->ops.has_signal = has_signal; |
673 | t->standby = standby; | 673 | t->ops.standby = standby; |
674 | t->release = tda8290_release; | 674 | t->ops.release = tda8290_release; |
675 | priv->tda827x_lpsel = 0; | 675 | priv->tda827x_lpsel = 0; |
676 | t->mode = V4L2_TUNER_ANALOG_TV; | 676 | t->mode = V4L2_TUNER_ANALOG_TV; |
677 | 677 | ||
diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c index f0443cc02e5c..5bb7d19edfbc 100644 --- a/drivers/media/video/tda9887.c +++ b/drivers/media/video/tda9887.c | |||
@@ -614,12 +614,12 @@ int tda9887_tuner_init(struct i2c_client *c) | |||
614 | tda9887_info("tda988[5/6/7] found @ 0x%x (%s)\n", t->i2c.addr, | 614 | tda9887_info("tda988[5/6/7] found @ 0x%x (%s)\n", t->i2c.addr, |
615 | t->i2c.driver->driver.name); | 615 | t->i2c.driver->driver.name); |
616 | 616 | ||
617 | t->set_tv_freq = tda9887_set_freq; | 617 | t->ops.set_tv_freq = tda9887_set_freq; |
618 | t->set_radio_freq = tda9887_set_freq; | 618 | t->ops.set_radio_freq = tda9887_set_freq; |
619 | t->standby = tda9887_standby; | 619 | t->ops.standby = tda9887_standby; |
620 | t->tuner_status = tda9887_tuner_status; | 620 | t->ops.tuner_status = tda9887_tuner_status; |
621 | t->get_afc = tda9887_get_afc; | 621 | t->ops.get_afc = tda9887_get_afc; |
622 | t->release = tda9887_release; | 622 | t->ops.release = tda9887_release; |
623 | 623 | ||
624 | return 0; | 624 | return 0; |
625 | } | 625 | } |
diff --git a/drivers/media/video/tea5761.c b/drivers/media/video/tea5761.c index 1479f16f9ab3..858f2d11496c 100644 --- a/drivers/media/video/tea5761.c +++ b/drivers/media/video/tea5761.c | |||
@@ -229,10 +229,10 @@ int tea5761_tuner_init(struct i2c_client *c) | |||
229 | tuner_info("type set to %d (%s)\n", t->type, "Philips TEA5761HN FM Radio"); | 229 | tuner_info("type set to %d (%s)\n", t->type, "Philips TEA5761HN FM Radio"); |
230 | strlcpy(c->name, "tea5761", sizeof(c->name)); | 230 | strlcpy(c->name, "tea5761", sizeof(c->name)); |
231 | 231 | ||
232 | t->set_tv_freq = set_tv_freq; | 232 | t->ops.set_tv_freq = set_tv_freq; |
233 | t->set_radio_freq = set_radio_freq; | 233 | t->ops.set_radio_freq = set_radio_freq; |
234 | t->has_signal = tea5761_signal; | 234 | t->ops.has_signal = tea5761_signal; |
235 | t->is_stereo = tea5761_stereo; | 235 | t->ops.is_stereo = tea5761_stereo; |
236 | 236 | ||
237 | return (0); | 237 | return (0); |
238 | } | 238 | } |
diff --git a/drivers/media/video/tea5767.c b/drivers/media/video/tea5767.c index d1c41781ccc4..c5510422aa3e 100644 --- a/drivers/media/video/tea5767.c +++ b/drivers/media/video/tea5767.c | |||
@@ -350,11 +350,11 @@ int tea5767_tuner_init(struct i2c_client *c) | |||
350 | tuner_info("type set to %d (%s)\n", t->type, "Philips TEA5767HN FM Radio"); | 350 | tuner_info("type set to %d (%s)\n", t->type, "Philips TEA5767HN FM Radio"); |
351 | strlcpy(c->name, "tea5767", sizeof(c->name)); | 351 | strlcpy(c->name, "tea5767", sizeof(c->name)); |
352 | 352 | ||
353 | t->set_tv_freq = set_tv_freq; | 353 | t->ops.set_tv_freq = set_tv_freq; |
354 | t->set_radio_freq = set_radio_freq; | 354 | t->ops.set_radio_freq = set_radio_freq; |
355 | t->has_signal = tea5767_signal; | 355 | t->ops.has_signal = tea5767_signal; |
356 | t->is_stereo = tea5767_stereo; | 356 | t->ops.is_stereo = tea5767_stereo; |
357 | t->standby = tea5767_standby; | 357 | t->ops.standby = tea5767_standby; |
358 | 358 | ||
359 | return (0); | 359 | return (0); |
360 | } | 360 | } |
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index acbffbfdb508..603476532f5c 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c | |||
@@ -80,7 +80,7 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq) | |||
80 | tuner_warn ("tuner type not set\n"); | 80 | tuner_warn ("tuner type not set\n"); |
81 | return; | 81 | return; |
82 | } | 82 | } |
83 | if (NULL == t->set_tv_freq) { | 83 | if (NULL == t->ops.set_tv_freq) { |
84 | tuner_warn ("Tuner has no way to set tv freq\n"); | 84 | tuner_warn ("Tuner has no way to set tv freq\n"); |
85 | return; | 85 | return; |
86 | } | 86 | } |
@@ -95,7 +95,7 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq) | |||
95 | else | 95 | else |
96 | freq = tv_range[1] * 16; | 96 | freq = tv_range[1] * 16; |
97 | } | 97 | } |
98 | t->set_tv_freq(c, freq); | 98 | t->ops.set_tv_freq(c, freq); |
99 | } | 99 | } |
100 | 100 | ||
101 | static void set_radio_freq(struct i2c_client *c, unsigned int freq) | 101 | static void set_radio_freq(struct i2c_client *c, unsigned int freq) |
@@ -106,7 +106,7 @@ static void set_radio_freq(struct i2c_client *c, unsigned int freq) | |||
106 | tuner_warn ("tuner type not set\n"); | 106 | tuner_warn ("tuner type not set\n"); |
107 | return; | 107 | return; |
108 | } | 108 | } |
109 | if (NULL == t->set_radio_freq) { | 109 | if (NULL == t->ops.set_radio_freq) { |
110 | tuner_warn ("tuner has no way to set radio frequency\n"); | 110 | tuner_warn ("tuner has no way to set radio frequency\n"); |
111 | return; | 111 | return; |
112 | } | 112 | } |
@@ -122,7 +122,7 @@ static void set_radio_freq(struct i2c_client *c, unsigned int freq) | |||
122 | freq = radio_range[1] * 16000; | 122 | freq = radio_range[1] * 16000; |
123 | } | 123 | } |
124 | 124 | ||
125 | t->set_radio_freq(c, freq); | 125 | t->ops.set_radio_freq(c, freq); |
126 | } | 126 | } |
127 | 127 | ||
128 | static void set_freq(struct i2c_client *c, unsigned long freq) | 128 | static void set_freq(struct i2c_client *c, unsigned long freq) |
@@ -178,8 +178,8 @@ static void set_type(struct i2c_client *c, unsigned int type, | |||
178 | } | 178 | } |
179 | 179 | ||
180 | /* discard private data, in case set_type() was previously called */ | 180 | /* discard private data, in case set_type() was previously called */ |
181 | if (t->release) | 181 | if (t->ops.release) |
182 | t->release(c); | 182 | t->ops.release(c); |
183 | else { | 183 | else { |
184 | kfree(t->priv); | 184 | kfree(t->priv); |
185 | t->priv = NULL; | 185 | t->priv = NULL; |
@@ -429,11 +429,11 @@ static void tuner_status(struct i2c_client *client) | |||
429 | tuner_info("Standard: 0x%08lx\n", (unsigned long)t->std); | 429 | tuner_info("Standard: 0x%08lx\n", (unsigned long)t->std); |
430 | if (t->mode != V4L2_TUNER_RADIO) | 430 | if (t->mode != V4L2_TUNER_RADIO) |
431 | return; | 431 | return; |
432 | if (t->has_signal) { | 432 | if (t->ops.has_signal) { |
433 | tuner_info("Signal strength: %d\n", t->has_signal(client)); | 433 | tuner_info("Signal strength: %d\n", t->ops.has_signal(client)); |
434 | } | 434 | } |
435 | if (t->is_stereo) { | 435 | if (t->ops.is_stereo) { |
436 | tuner_info("Stereo: %s\n", t->is_stereo(client) ? "yes" : "no"); | 436 | tuner_info("Stereo: %s\n", t->ops.is_stereo(client) ? "yes" : "no"); |
437 | } | 437 | } |
438 | } | 438 | } |
439 | 439 | ||
@@ -460,7 +460,7 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind) | |||
460 | t->type = UNSET; | 460 | t->type = UNSET; |
461 | t->audmode = V4L2_TUNER_MODE_STEREO; | 461 | t->audmode = V4L2_TUNER_MODE_STEREO; |
462 | t->mode_mask = T_UNINITIALIZED; | 462 | t->mode_mask = T_UNINITIALIZED; |
463 | t->tuner_status = tuner_status; | 463 | t->ops.tuner_status = tuner_status; |
464 | 464 | ||
465 | if (show_i2c) { | 465 | if (show_i2c) { |
466 | unsigned char buffer[16]; | 466 | unsigned char buffer[16]; |
@@ -566,8 +566,8 @@ static int tuner_detach(struct i2c_client *client) | |||
566 | return err; | 566 | return err; |
567 | } | 567 | } |
568 | 568 | ||
569 | if (t->release) | 569 | if (t->ops.release) |
570 | t->release(client); | 570 | t->ops.release(client); |
571 | else { | 571 | else { |
572 | kfree(t->priv); | 572 | kfree(t->priv); |
573 | } | 573 | } |
@@ -591,8 +591,8 @@ static inline int set_mode(struct i2c_client *client, struct tuner *t, int mode, | |||
591 | 591 | ||
592 | if (check_mode(t, cmd) == EINVAL) { | 592 | if (check_mode(t, cmd) == EINVAL) { |
593 | t->mode = T_STANDBY; | 593 | t->mode = T_STANDBY; |
594 | if (t->standby) | 594 | if (t->ops.standby) |
595 | t->standby (client); | 595 | t->ops.standby (client); |
596 | return EINVAL; | 596 | return EINVAL; |
597 | } | 597 | } |
598 | return 0; | 598 | return 0; |
@@ -640,8 +640,8 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
640 | if (check_mode(t, "TUNER_SET_STANDBY") == EINVAL) | 640 | if (check_mode(t, "TUNER_SET_STANDBY") == EINVAL) |
641 | return 0; | 641 | return 0; |
642 | t->mode = T_STANDBY; | 642 | t->mode = T_STANDBY; |
643 | if (t->standby) | 643 | if (t->ops.standby) |
644 | t->standby (client); | 644 | t->ops.standby (client); |
645 | break; | 645 | break; |
646 | #ifdef CONFIG_VIDEO_V4L1 | 646 | #ifdef CONFIG_VIDEO_V4L1 |
647 | case VIDIOCSAUDIO: | 647 | case VIDIOCSAUDIO: |
@@ -700,10 +700,10 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
700 | return 0; | 700 | return 0; |
701 | 701 | ||
702 | if (V4L2_TUNER_RADIO == t->mode) { | 702 | if (V4L2_TUNER_RADIO == t->mode) { |
703 | if (t->has_signal) | 703 | if (t->ops.has_signal) |
704 | vt->signal = t->has_signal(client); | 704 | vt->signal = t->ops.has_signal(client); |
705 | if (t->is_stereo) { | 705 | if (t->ops.is_stereo) { |
706 | if (t->is_stereo(client)) | 706 | if (t->ops.is_stereo(client)) |
707 | vt->flags |= | 707 | vt->flags |= |
708 | VIDEO_TUNER_STEREO_ON; | 708 | VIDEO_TUNER_STEREO_ON; |
709 | else | 709 | else |
@@ -731,8 +731,8 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
731 | if (check_v4l2(t) == EINVAL) | 731 | if (check_v4l2(t) == EINVAL) |
732 | return 0; | 732 | return 0; |
733 | 733 | ||
734 | if (V4L2_TUNER_RADIO == t->mode && t->is_stereo) | 734 | if (V4L2_TUNER_RADIO == t->mode && t->ops.is_stereo) |
735 | va->mode = t->is_stereo(client) | 735 | va->mode = t->ops.is_stereo(client) |
736 | ? VIDEO_SOUND_STEREO : VIDEO_SOUND_MONO; | 736 | ? VIDEO_SOUND_STEREO : VIDEO_SOUND_MONO; |
737 | return 0; | 737 | return 0; |
738 | } | 738 | } |
@@ -797,8 +797,8 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
797 | switch_v4l2(); | 797 | switch_v4l2(); |
798 | 798 | ||
799 | tuner->type = t->mode; | 799 | tuner->type = t->mode; |
800 | if (t->get_afc) | 800 | if (t->ops.get_afc) |
801 | tuner->afc=t->get_afc(client); | 801 | tuner->afc=t->ops.get_afc(client); |
802 | if (t->mode == V4L2_TUNER_ANALOG_TV) | 802 | if (t->mode == V4L2_TUNER_ANALOG_TV) |
803 | tuner->capability |= V4L2_TUNER_CAP_NORM; | 803 | tuner->capability |= V4L2_TUNER_CAP_NORM; |
804 | if (t->mode != V4L2_TUNER_RADIO) { | 804 | if (t->mode != V4L2_TUNER_RADIO) { |
@@ -808,13 +808,13 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
808 | } | 808 | } |
809 | 809 | ||
810 | /* radio mode */ | 810 | /* radio mode */ |
811 | if (t->has_signal) | 811 | if (t->ops.has_signal) |
812 | tuner->signal = t->has_signal(client); | 812 | tuner->signal = t->ops.has_signal(client); |
813 | 813 | ||
814 | tuner->rxsubchans = | 814 | tuner->rxsubchans = |
815 | V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; | 815 | V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; |
816 | if (t->is_stereo) { | 816 | if (t->ops.is_stereo) { |
817 | tuner->rxsubchans = t->is_stereo(client) ? | 817 | tuner->rxsubchans = t->ops.is_stereo(client) ? |
818 | V4L2_TUNER_SUB_STEREO : V4L2_TUNER_SUB_MONO; | 818 | V4L2_TUNER_SUB_STEREO : V4L2_TUNER_SUB_MONO; |
819 | } | 819 | } |
820 | 820 | ||
@@ -842,8 +842,8 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
842 | break; | 842 | break; |
843 | } | 843 | } |
844 | case VIDIOC_LOG_STATUS: | 844 | case VIDIOC_LOG_STATUS: |
845 | if (t->tuner_status) | 845 | if (t->ops.tuner_status) |
846 | t->tuner_status(client); | 846 | t->ops.tuner_status(client); |
847 | break; | 847 | break; |
848 | } | 848 | } |
849 | 849 | ||
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c index b5792d6a73f3..fb4addbd5eb6 100644 --- a/drivers/media/video/tuner-simple.c +++ b/drivers/media/video/tuner-simple.c | |||
@@ -487,11 +487,11 @@ int default_tuner_init(struct i2c_client *c) | |||
487 | t->type, tuners[t->type].name); | 487 | t->type, tuners[t->type].name); |
488 | strlcpy(c->name, tuners[t->type].name, sizeof(c->name)); | 488 | strlcpy(c->name, tuners[t->type].name, sizeof(c->name)); |
489 | 489 | ||
490 | t->set_tv_freq = default_set_tv_freq; | 490 | t->ops.set_tv_freq = default_set_tv_freq; |
491 | t->set_radio_freq = default_set_radio_freq; | 491 | t->ops.set_radio_freq = default_set_radio_freq; |
492 | t->has_signal = tuner_signal; | 492 | t->ops.has_signal = tuner_signal; |
493 | t->is_stereo = tuner_stereo; | 493 | t->ops.is_stereo = tuner_stereo; |
494 | t->standby = NULL; | 494 | t->ops.standby = NULL; |
495 | 495 | ||
496 | return 0; | 496 | return 0; |
497 | } | 497 | } |