diff options
author | lawrence rust <lawrence@softsystem.co.uk> | 2010-08-23 06:49:58 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-10-20 23:04:49 -0400 |
commit | d06b49ed18736d32530067e2cad5a18d3482a2b9 (patch) | |
tree | c3fb0784e85c04199bdae96b632c1443da2a0c9c /drivers/media/video/cx88 | |
parent | 3053814c1cbedb9d2802240f414588009706c74d (diff) |
V4L/DVB: cx88: convert core->tvaudio into an enum
Using an enum and removing the default case from switch statements accessing
the value enables the compiler to emit a warning (enabled with -Wall) when an
audio mode is not handled.
This highlights an omission in the function cx88_dsp_detect_stereo_sap()
(in cx88-dsp.c) not handling WW_EIAJ and WW_M.
Signed-off-by: Lawrence Rust <lawrence@softsystem.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx88')
-rw-r--r-- | drivers/media/video/cx88/cx88-core.c | 2 | ||||
-rw-r--r-- | drivers/media/video/cx88/cx88-dsp.c | 17 | ||||
-rw-r--r-- | drivers/media/video/cx88/cx88-tvaudio.c | 37 | ||||
-rw-r--r-- | drivers/media/video/cx88/cx88.h | 28 |
4 files changed, 64 insertions, 20 deletions
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c index 85eb266fb351..56066a1ff20d 100644 --- a/drivers/media/video/cx88/cx88-core.c +++ b/drivers/media/video/cx88/cx88-core.c | |||
@@ -879,7 +879,7 @@ static int set_tvaudio(struct cx88_core *core) | |||
879 | } else { | 879 | } else { |
880 | printk("%s/0: tvaudio support needs work for this tv norm [%s], sorry\n", | 880 | printk("%s/0: tvaudio support needs work for this tv norm [%s], sorry\n", |
881 | core->name, v4l2_norm_to_name(core->tvnorm)); | 881 | core->name, v4l2_norm_to_name(core->tvnorm)); |
882 | core->tvaudio = 0; | 882 | core->tvaudio = WW_NONE; |
883 | return 0; | 883 | return 0; |
884 | } | 884 | } |
885 | 885 | ||
diff --git a/drivers/media/video/cx88/cx88-dsp.c b/drivers/media/video/cx88/cx88-dsp.c index a94e00a4ac5d..e1d6eef233dc 100644 --- a/drivers/media/video/cx88/cx88-dsp.c +++ b/drivers/media/video/cx88/cx88-dsp.c | |||
@@ -175,7 +175,13 @@ static s32 detect_a2_a2m_eiaj(struct cx88_core *core, s16 x[], u32 N) | |||
175 | stereo_freq = FREQ_EIAJ_STEREO; | 175 | stereo_freq = FREQ_EIAJ_STEREO; |
176 | dual_freq = FREQ_EIAJ_DUAL; | 176 | dual_freq = FREQ_EIAJ_DUAL; |
177 | break; | 177 | break; |
178 | default: | 178 | case WW_NONE: |
179 | case WW_BTSC: | ||
180 | case WW_I: | ||
181 | case WW_L: | ||
182 | case WW_I2SPT: | ||
183 | case WW_FM: | ||
184 | case WW_I2SADC: | ||
179 | printk(KERN_WARNING "%s/0: unsupported audio mode %d for %s\n", | 185 | printk(KERN_WARNING "%s/0: unsupported audio mode %d for %s\n", |
180 | core->name, core->tvaudio, __func__); | 186 | core->name, core->tvaudio, __func__); |
181 | return UNSET; | 187 | return UNSET; |
@@ -292,11 +298,20 @@ s32 cx88_dsp_detect_stereo_sap(struct cx88_core *core) | |||
292 | switch (core->tvaudio) { | 298 | switch (core->tvaudio) { |
293 | case WW_BG: | 299 | case WW_BG: |
294 | case WW_DK: | 300 | case WW_DK: |
301 | case WW_EIAJ: | ||
302 | case WW_M: | ||
295 | ret = detect_a2_a2m_eiaj(core, samples, N); | 303 | ret = detect_a2_a2m_eiaj(core, samples, N); |
296 | break; | 304 | break; |
297 | case WW_BTSC: | 305 | case WW_BTSC: |
298 | ret = detect_btsc(core, samples, N); | 306 | ret = detect_btsc(core, samples, N); |
299 | break; | 307 | break; |
308 | case WW_NONE: | ||
309 | case WW_I: | ||
310 | case WW_L: | ||
311 | case WW_I2SPT: | ||
312 | case WW_FM: | ||
313 | case WW_I2SADC: | ||
314 | break; | ||
300 | } | 315 | } |
301 | 316 | ||
302 | kfree(samples); | 317 | kfree(samples); |
diff --git a/drivers/media/video/cx88/cx88-tvaudio.c b/drivers/media/video/cx88/cx88-tvaudio.c index 239631568f3b..db6354709064 100644 --- a/drivers/media/video/cx88/cx88-tvaudio.c +++ b/drivers/media/video/cx88/cx88-tvaudio.c | |||
@@ -360,7 +360,15 @@ static void set_audio_standard_NICAM(struct cx88_core *core, u32 mode) | |||
360 | set_audio_registers(core, nicam_bgdki_common); | 360 | set_audio_registers(core, nicam_bgdki_common); |
361 | set_audio_registers(core, nicam_i); | 361 | set_audio_registers(core, nicam_i); |
362 | break; | 362 | break; |
363 | default: | 363 | case WW_NONE: |
364 | case WW_BTSC: | ||
365 | case WW_BG: | ||
366 | case WW_DK: | ||
367 | case WW_EIAJ: | ||
368 | case WW_I2SPT: | ||
369 | case WW_FM: | ||
370 | case WW_I2SADC: | ||
371 | case WW_M: | ||
364 | dprintk("%s PAL-BGDK NICAM (status: known-good)\n", __func__); | 372 | dprintk("%s PAL-BGDK NICAM (status: known-good)\n", __func__); |
365 | set_audio_registers(core, nicam_bgdki_common); | 373 | set_audio_registers(core, nicam_bgdki_common); |
366 | set_audio_registers(core, nicam_default); | 374 | set_audio_registers(core, nicam_default); |
@@ -621,7 +629,13 @@ static void set_audio_standard_A2(struct cx88_core *core, u32 mode) | |||
621 | dprintk("%s AM-L (status: devel)\n", __func__); | 629 | dprintk("%s AM-L (status: devel)\n", __func__); |
622 | set_audio_registers(core, am_l); | 630 | set_audio_registers(core, am_l); |
623 | break; | 631 | break; |
624 | default: | 632 | case WW_NONE: |
633 | case WW_BTSC: | ||
634 | case WW_EIAJ: | ||
635 | case WW_I2SPT: | ||
636 | case WW_FM: | ||
637 | case WW_I2SADC: | ||
638 | case WW_M: | ||
625 | dprintk("%s Warning: wrong value\n", __func__); | 639 | dprintk("%s Warning: wrong value\n", __func__); |
626 | return; | 640 | return; |
627 | break; | 641 | break; |
@@ -779,7 +793,7 @@ void cx88_set_tvaudio(struct cx88_core *core) | |||
779 | set_audio_finish(core, EN_I2SIN_ENABLE); | 793 | set_audio_finish(core, EN_I2SIN_ENABLE); |
780 | break; | 794 | break; |
781 | case WW_NONE: | 795 | case WW_NONE: |
782 | default: | 796 | case WW_I2SPT: |
783 | printk("%s/0: unknown tv audio mode [%d]\n", | 797 | printk("%s/0: unknown tv audio mode [%d]\n", |
784 | core->name, core->tvaudio); | 798 | core->name, core->tvaudio); |
785 | break; | 799 | break; |
@@ -840,7 +854,12 @@ void cx88_get_stereo(struct cx88_core *core, struct v4l2_tuner *t) | |||
840 | break; | 854 | break; |
841 | } | 855 | } |
842 | break; | 856 | break; |
843 | default: | 857 | case WW_NONE: |
858 | case WW_I: | ||
859 | case WW_L: | ||
860 | case WW_I2SPT: | ||
861 | case WW_FM: | ||
862 | case WW_I2SADC: | ||
844 | /* nothing */ | 863 | /* nothing */ |
845 | break; | 864 | break; |
846 | } | 865 | } |
@@ -945,6 +964,9 @@ void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual) | |||
945 | } | 964 | } |
946 | break; | 965 | break; |
947 | case WW_I2SADC: | 966 | case WW_I2SADC: |
967 | case WW_NONE: | ||
968 | case WW_EIAJ: | ||
969 | case WW_I2SPT: | ||
948 | /* DO NOTHING */ | 970 | /* DO NOTHING */ |
949 | break; | 971 | break; |
950 | } | 972 | } |
@@ -1000,7 +1022,12 @@ int cx88_audio_thread(void *data) | |||
1000 | /* automatically switch to best available mode */ | 1022 | /* automatically switch to best available mode */ |
1001 | cx88_set_stereo(core, mode, 0); | 1023 | cx88_set_stereo(core, mode, 0); |
1002 | break; | 1024 | break; |
1003 | default: | 1025 | case WW_NONE: |
1026 | case WW_BTSC: | ||
1027 | case WW_EIAJ: | ||
1028 | case WW_I2SPT: | ||
1029 | case WW_FM: | ||
1030 | case WW_I2SADC: | ||
1004 | hw_autodetect: | 1031 | hw_autodetect: |
1005 | /* stereo autodetection is supported by hardware so | 1032 | /* stereo autodetection is supported by hardware so |
1006 | we don't need to do it manually. Do nothing. */ | 1033 | we don't need to do it manually. Do nothing. */ |
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index 33d161a11725..d9554090eb6f 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h | |||
@@ -281,6 +281,20 @@ struct cx88_subid { | |||
281 | u32 card; | 281 | u32 card; |
282 | }; | 282 | }; |
283 | 283 | ||
284 | enum cx88_tvaudio { | ||
285 | WW_NONE = 1, | ||
286 | WW_BTSC, | ||
287 | WW_BG, | ||
288 | WW_DK, | ||
289 | WW_I, | ||
290 | WW_L, | ||
291 | WW_EIAJ, | ||
292 | WW_I2SPT, | ||
293 | WW_FM, | ||
294 | WW_I2SADC, | ||
295 | WW_M | ||
296 | }; | ||
297 | |||
284 | #define INPUT(nr) (core->board.input[nr]) | 298 | #define INPUT(nr) (core->board.input[nr]) |
285 | 299 | ||
286 | /* ----------------------------------------------------------- */ | 300 | /* ----------------------------------------------------------- */ |
@@ -352,7 +366,7 @@ struct cx88_core { | |||
352 | /* state info */ | 366 | /* state info */ |
353 | struct task_struct *kthread; | 367 | struct task_struct *kthread; |
354 | v4l2_std_id tvnorm; | 368 | v4l2_std_id tvnorm; |
355 | u32 tvaudio; | 369 | enum cx88_tvaudio tvaudio; |
356 | u32 audiomode_manual; | 370 | u32 audiomode_manual; |
357 | u32 audiomode_current; | 371 | u32 audiomode_current; |
358 | u32 input; | 372 | u32 input; |
@@ -651,18 +665,6 @@ extern void cx88_setup_xc3028(struct cx88_core *core, struct xc2028_ctrl *ctl); | |||
651 | /* ----------------------------------------------------------- */ | 665 | /* ----------------------------------------------------------- */ |
652 | /* cx88-tvaudio.c */ | 666 | /* cx88-tvaudio.c */ |
653 | 667 | ||
654 | #define WW_NONE 1 | ||
655 | #define WW_BTSC 2 | ||
656 | #define WW_BG 3 | ||
657 | #define WW_DK 4 | ||
658 | #define WW_I 5 | ||
659 | #define WW_L 6 | ||
660 | #define WW_EIAJ 7 | ||
661 | #define WW_I2SPT 8 | ||
662 | #define WW_FM 9 | ||
663 | #define WW_I2SADC 10 | ||
664 | #define WW_M 11 | ||
665 | |||
666 | void cx88_set_tvaudio(struct cx88_core *core); | 668 | void cx88_set_tvaudio(struct cx88_core *core); |
667 | void cx88_newstation(struct cx88_core *core); | 669 | void cx88_newstation(struct cx88_core *core); |
668 | void cx88_get_stereo(struct cx88_core *core, struct v4l2_tuner *t); | 670 | void cx88_get_stereo(struct cx88_core *core, struct v4l2_tuner *t); |