aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2011-02-04 09:28:00 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-03-21 19:32:02 -0400
commit7d275bf840a8f390b8fd3d686545e09ef01f7915 (patch)
tree1475c148fc07f5c9561faa6f3c8b72b8312b3167
parente2f63d9ba51efe8930bf1c952c66b971047d355d (diff)
[media] tuner-core: CodingStyle cleanups
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/tuner-core.c92
1 files changed, 47 insertions, 45 deletions
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index e6b63e9c0b34..70ff416c0ced 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -32,7 +32,7 @@
32 32
33#define UNSET (-1U) 33#define UNSET (-1U)
34 34
35#define PREFIX t->i2c->driver->driver.name 35#define PREFIX (t->i2c->driver->driver.name)
36 36
37/* 37/*
38 * Driver modprobe parameters 38 * Driver modprobe parameters
@@ -55,7 +55,7 @@ static char pal[] = "--";
55static char secam[] = "--"; 55static char secam[] = "--";
56static char ntsc[] = "-"; 56static char ntsc[] = "-";
57 57
58module_param_named(debug,tuner_debug, int, 0644); 58module_param_named(debug, tuner_debug, int, 0644);
59module_param_array(tv_range, int, NULL, 0644); 59module_param_array(tv_range, int, NULL, 0644);
60module_param_array(radio_range, int, NULL, 0644); 60module_param_array(radio_range, int, NULL, 0644);
61module_param_string(pal, pal, sizeof(pal), 0644); 61module_param_string(pal, pal, sizeof(pal), 0644);
@@ -252,7 +252,7 @@ static void set_type(struct i2c_client *c, unsigned int type,
252 int tune_now = 1; 252 int tune_now = 1;
253 253
254 if (type == UNSET || type == TUNER_ABSENT) { 254 if (type == UNSET || type == TUNER_ABSENT) {
255 tuner_dbg ("tuner 0x%02x: Tuner type absent\n",c->addr); 255 tuner_dbg("tuner 0x%02x: Tuner type absent\n", c->addr);
256 return; 256 return;
257 } 257 }
258 258
@@ -422,9 +422,9 @@ static void set_addr(struct i2c_client *c, struct tuner_setup *tun_setup)
422{ 422{
423 struct tuner *t = to_tuner(i2c_get_clientdata(c)); 423 struct tuner *t = to_tuner(i2c_get_clientdata(c));
424 424
425 if ( (t->type == UNSET && ((tun_setup->addr == ADDR_UNSET) && 425 if ((t->type == UNSET && ((tun_setup->addr == ADDR_UNSET) &&
426 (t->mode_mask & tun_setup->mode_mask))) || 426 (t->mode_mask & tun_setup->mode_mask))) ||
427 (tun_setup->addr == c->addr)) { 427 (tun_setup->addr == c->addr)) {
428 set_type(c, tun_setup->type, tun_setup->mode_mask, 428 set_type(c, tun_setup->type, tun_setup->mode_mask,
429 tun_setup->config, tun_setup->tuner_callback); 429 tun_setup->config, tun_setup->tuner_callback);
430 } else 430 } else
@@ -449,7 +449,8 @@ static int tuner_s_type_addr(struct v4l2_subdev *sd, struct tuner_setup *type)
449 return 0; 449 return 0;
450} 450}
451 451
452static int tuner_s_config(struct v4l2_subdev *sd, const struct v4l2_priv_tun_config *cfg) 452static int tuner_s_config(struct v4l2_subdev *sd,
453 const struct v4l2_priv_tun_config *cfg)
453{ 454{
454 struct tuner *t = to_tuner(sd); 455 struct tuner *t = to_tuner(sd);
455 struct analog_demod_ops *analog_ops = &t->fe.ops.analog_ops; 456 struct analog_demod_ops *analog_ops = &t->fe.ops.analog_ops;
@@ -601,13 +602,12 @@ static int tuner_probe(struct i2c_client *client,
601 /* Should be just before return */ 602 /* Should be just before return */
602register_client: 603register_client:
603 /* Sets a default mode */ 604 /* Sets a default mode */
604 if (t->mode_mask & T_ANALOG_TV) { 605 if (t->mode_mask & T_ANALOG_TV)
605 t->mode = V4L2_TUNER_ANALOG_TV; 606 t->mode = V4L2_TUNER_ANALOG_TV;
606 } else if (t->mode_mask & T_RADIO) { 607 else if (t->mode_mask & T_RADIO)
607 t->mode = V4L2_TUNER_RADIO; 608 t->mode = V4L2_TUNER_RADIO;
608 } else { 609 else
609 t->mode = V4L2_TUNER_DIGITAL_TV; 610 t->mode = V4L2_TUNER_DIGITAL_TV;
610 }
611 set_type(client, t->type, t->mode_mask, t->config, t->fe.callback); 611 set_type(client, t->type, t->mode_mask, t->config, t->fe.callback);
612 list_add_tail(&t->list, &tuner_list); 612 list_add_tail(&t->list, &tuner_list);
613 613
@@ -649,15 +649,15 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq)
649 }; 649 };
650 650
651 if (t->type == UNSET) { 651 if (t->type == UNSET) {
652 tuner_warn ("tuner type not set\n"); 652 tuner_warn("tuner type not set\n");
653 return; 653 return;
654 } 654 }
655 if (NULL == analog_ops->set_params) { 655 if (NULL == analog_ops->set_params) {
656 tuner_warn ("Tuner has no way to set tv freq\n"); 656 tuner_warn("Tuner has no way to set tv freq\n");
657 return; 657 return;
658 } 658 }
659 if (freq < tv_range[0] * 16 || freq > tv_range[1] * 16) { 659 if (freq < tv_range[0] * 16 || freq > tv_range[1] * 16) {
660 tuner_dbg ("TV freq (%d.%02d) out of range (%d-%d)\n", 660 tuner_dbg("TV freq (%d.%02d) out of range (%d-%d)\n",
661 freq / 16, freq % 16 * 100 / 16, tv_range[0], 661 freq / 16, freq % 16 * 100 / 16, tv_range[0],
662 tv_range[1]); 662 tv_range[1]);
663 /* V4L2 spec: if the freq is not possible then the closest 663 /* V4L2 spec: if the freq is not possible then the closest
@@ -682,31 +682,31 @@ static int tuner_fixup_std(struct tuner *t)
682 if ((t->std & V4L2_STD_PAL) == V4L2_STD_PAL) { 682 if ((t->std & V4L2_STD_PAL) == V4L2_STD_PAL) {
683 switch (pal[0]) { 683 switch (pal[0]) {
684 case '6': 684 case '6':
685 tuner_dbg ("insmod fixup: PAL => PAL-60\n"); 685 tuner_dbg("insmod fixup: PAL => PAL-60\n");
686 t->std = V4L2_STD_PAL_60; 686 t->std = V4L2_STD_PAL_60;
687 break; 687 break;
688 case 'b': 688 case 'b':
689 case 'B': 689 case 'B':
690 case 'g': 690 case 'g':
691 case 'G': 691 case 'G':
692 tuner_dbg ("insmod fixup: PAL => PAL-BG\n"); 692 tuner_dbg("insmod fixup: PAL => PAL-BG\n");
693 t->std = V4L2_STD_PAL_BG; 693 t->std = V4L2_STD_PAL_BG;
694 break; 694 break;
695 case 'i': 695 case 'i':
696 case 'I': 696 case 'I':
697 tuner_dbg ("insmod fixup: PAL => PAL-I\n"); 697 tuner_dbg("insmod fixup: PAL => PAL-I\n");
698 t->std = V4L2_STD_PAL_I; 698 t->std = V4L2_STD_PAL_I;
699 break; 699 break;
700 case 'd': 700 case 'd':
701 case 'D': 701 case 'D':
702 case 'k': 702 case 'k':
703 case 'K': 703 case 'K':
704 tuner_dbg ("insmod fixup: PAL => PAL-DK\n"); 704 tuner_dbg("insmod fixup: PAL => PAL-DK\n");
705 t->std = V4L2_STD_PAL_DK; 705 t->std = V4L2_STD_PAL_DK;
706 break; 706 break;
707 case 'M': 707 case 'M':
708 case 'm': 708 case 'm':
709 tuner_dbg ("insmod fixup: PAL => PAL-M\n"); 709 tuner_dbg("insmod fixup: PAL => PAL-M\n");
710 t->std = V4L2_STD_PAL_M; 710 t->std = V4L2_STD_PAL_M;
711 break; 711 break;
712 case 'N': 712 case 'N':
@@ -715,7 +715,7 @@ static int tuner_fixup_std(struct tuner *t)
715 tuner_dbg("insmod fixup: PAL => PAL-Nc\n"); 715 tuner_dbg("insmod fixup: PAL => PAL-Nc\n");
716 t->std = V4L2_STD_PAL_Nc; 716 t->std = V4L2_STD_PAL_Nc;
717 } else { 717 } else {
718 tuner_dbg ("insmod fixup: PAL => PAL-N\n"); 718 tuner_dbg("insmod fixup: PAL => PAL-N\n");
719 t->std = V4L2_STD_PAL_N; 719 t->std = V4L2_STD_PAL_N;
720 } 720 }
721 break; 721 break;
@@ -723,7 +723,7 @@ static int tuner_fixup_std(struct tuner *t)
723 /* default parameter, do nothing */ 723 /* default parameter, do nothing */
724 break; 724 break;
725 default: 725 default:
726 tuner_warn ("pal= argument not recognised\n"); 726 tuner_warn("pal= argument not recognised\n");
727 break; 727 break;
728 } 728 }
729 } 729 }
@@ -736,22 +736,24 @@ static int tuner_fixup_std(struct tuner *t)
736 case 'h': 736 case 'h':
737 case 'H': 737 case 'H':
738 tuner_dbg("insmod fixup: SECAM => SECAM-BGH\n"); 738 tuner_dbg("insmod fixup: SECAM => SECAM-BGH\n");
739 t->std = V4L2_STD_SECAM_B | V4L2_STD_SECAM_G | V4L2_STD_SECAM_H; 739 t->std = V4L2_STD_SECAM_B |
740 V4L2_STD_SECAM_G |
741 V4L2_STD_SECAM_H;
740 break; 742 break;
741 case 'd': 743 case 'd':
742 case 'D': 744 case 'D':
743 case 'k': 745 case 'k':
744 case 'K': 746 case 'K':
745 tuner_dbg ("insmod fixup: SECAM => SECAM-DK\n"); 747 tuner_dbg("insmod fixup: SECAM => SECAM-DK\n");
746 t->std = V4L2_STD_SECAM_DK; 748 t->std = V4L2_STD_SECAM_DK;
747 break; 749 break;
748 case 'l': 750 case 'l':
749 case 'L': 751 case 'L':
750 if ((secam[1]=='C')||(secam[1]=='c')) { 752 if ((secam[1] == 'C') || (secam[1] == 'c')) {
751 tuner_dbg ("insmod fixup: SECAM => SECAM-L'\n"); 753 tuner_dbg("insmod fixup: SECAM => SECAM-L'\n");
752 t->std = V4L2_STD_SECAM_LC; 754 t->std = V4L2_STD_SECAM_LC;
753 } else { 755 } else {
754 tuner_dbg ("insmod fixup: SECAM => SECAM-L\n"); 756 tuner_dbg("insmod fixup: SECAM => SECAM-L\n");
755 t->std = V4L2_STD_SECAM_L; 757 t->std = V4L2_STD_SECAM_L;
756 } 758 }
757 break; 759 break;
@@ -759,7 +761,7 @@ static int tuner_fixup_std(struct tuner *t)
759 /* default parameter, do nothing */ 761 /* default parameter, do nothing */
760 break; 762 break;
761 default: 763 default:
762 tuner_warn ("secam= argument not recognised\n"); 764 tuner_warn("secam= argument not recognised\n");
763 break; 765 break;
764 } 766 }
765 } 767 }
@@ -808,15 +810,15 @@ static void set_radio_freq(struct i2c_client *c, unsigned int freq)
808 }; 810 };
809 811
810 if (t->type == UNSET) { 812 if (t->type == UNSET) {
811 tuner_warn ("tuner type not set\n"); 813 tuner_warn("tuner type not set\n");
812 return; 814 return;
813 } 815 }
814 if (NULL == analog_ops->set_params) { 816 if (NULL == analog_ops->set_params) {
815 tuner_warn ("tuner has no way to set radio frequency\n"); 817 tuner_warn("tuner has no way to set radio frequency\n");
816 return; 818 return;
817 } 819 }
818 if (freq < radio_range[0] * 16000 || freq > radio_range[1] * 16000) { 820 if (freq < radio_range[0] * 16000 || freq > radio_range[1] * 16000) {
819 tuner_dbg ("radio freq (%d.%02d) out of range (%d-%d)\n", 821 tuner_dbg("radio freq (%d.%02d) out of range (%d-%d)\n",
820 freq / 16000, freq % 16000 * 100 / 16000, 822 freq / 16000, freq % 16000 * 100 / 16000,
821 radio_range[0], radio_range[1]); 823 radio_range[0], radio_range[1]);
822 /* V4L2 spec: if the freq is not possible then the closest 824 /* V4L2 spec: if the freq is not possible then the closest
@@ -848,9 +850,9 @@ static void set_radio_freq(struct i2c_client *c, unsigned int freq)
848 */ 850 */
849static inline int check_mode(struct tuner *t, enum v4l2_tuner_type mode) 851static inline int check_mode(struct tuner *t, enum v4l2_tuner_type mode)
850{ 852{
851 if ((1 << mode & t->mode_mask) == 0) { 853 if ((1 << mode & t->mode_mask) == 0)
852 return -EINVAL; 854 return -EINVAL;
853 } 855
854 return 0; 856 return 0;
855} 857}
856 858
@@ -867,7 +869,7 @@ static inline int check_mode(struct tuner *t, enum v4l2_tuner_type mode)
867 * the tuner can sleep or if it supports both Radio and TV. 869 * the tuner can sleep or if it supports both Radio and TV.
868 */ 870 */
869static int set_mode_freq(struct i2c_client *client, struct tuner *t, 871static int set_mode_freq(struct i2c_client *client, struct tuner *t,
870 enum v4l2_tuner_type mode, unsigned int freq) 872 enum v4l2_tuner_type mode, unsigned int freq)
871{ 873{
872 struct analog_demod_ops *analog_ops = &t->fe.ops.analog_ops; 874 struct analog_demod_ops *analog_ops = &t->fe.ops.analog_ops;
873 875
@@ -913,7 +915,7 @@ static void set_freq(struct i2c_client *c, unsigned long freq)
913 set_tv_freq(c, freq); 915 set_tv_freq(c, freq);
914 break; 916 break;
915 default: 917 default:
916 tuner_dbg("freq set: unknown mode: 0x%04x!\n",t->mode); 918 tuner_dbg("freq set: unknown mode: 0x%04x!\n", t->mode);
917 } 919 }
918} 920}
919 921
@@ -933,16 +935,16 @@ static void tuner_status(struct dvb_frontend *fe)
933 const char *p; 935 const char *p;
934 936
935 switch (t->mode) { 937 switch (t->mode) {
936 case V4L2_TUNER_RADIO: 938 case V4L2_TUNER_RADIO:
937 p = "radio"; 939 p = "radio";
938 break; 940 break;
939 case V4L2_TUNER_DIGITAL_TV: 941 case V4L2_TUNER_DIGITAL_TV:
940 p = "digital TV"; 942 p = "digital TV";
941 break; 943 break;
942 case V4L2_TUNER_ANALOG_TV: 944 case V4L2_TUNER_ANALOG_TV:
943 default: 945 default:
944 p = "analog TV"; 946 p = "analog TV";
945 break; 947 break;
946 } 948 }
947 if (t->mode == V4L2_TUNER_RADIO) { 949 if (t->mode == V4L2_TUNER_RADIO) {
948 freq = t->radio_freq / 16000; 950 freq = t->radio_freq / 16000;
@@ -956,7 +958,7 @@ static void tuner_status(struct dvb_frontend *fe)
956 tuner_info("Frequency: %lu.%02lu MHz\n", freq, freq_fraction); 958 tuner_info("Frequency: %lu.%02lu MHz\n", freq, freq_fraction);
957 tuner_info("Standard: 0x%08lx\n", (unsigned long)t->std); 959 tuner_info("Standard: 0x%08lx\n", (unsigned long)t->std);
958 if (t->mode != V4L2_TUNER_RADIO) 960 if (t->mode != V4L2_TUNER_RADIO)
959 return; 961 return;
960 if (fe_tuner_ops->get_status) { 962 if (fe_tuner_ops->get_status) {
961 u32 tuner_status; 963 u32 tuner_status;
962 964