aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-10-20 12:14:24 -0400
committerTakashi Iwai <tiwai@suse.de>2014-10-21 02:32:47 -0400
commit4e28350a8c54a8b873b610311eb384a619c4045b (patch)
tree07583b53c85416edaab289a44a73d1f7c684598f /sound/isa
parent69b0c762cfd4c5e86a5b1fc0074889881b859c4a (diff)
ALSA: es18xx: Use snd_ctl_enum_info()
... and reduce the open codes. Also add missing const to text arrays. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/isa')
-rw-r--r--sound/isa/es18xx.c26
1 files changed, 5 insertions, 21 deletions
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c
index 6faaac60161a..63e7323e218f 100644
--- a/sound/isa/es18xx.c
+++ b/sound/isa/es18xx.c
@@ -964,44 +964,28 @@ static int snd_es18xx_capture_close(struct snd_pcm_substream *substream)
964 964
965static int snd_es18xx_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 965static int snd_es18xx_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
966{ 966{
967 static char *texts5Source[5] = { 967 static const char * const texts5Source[5] = {
968 "Mic", "CD", "Line", "Master", "Mix" 968 "Mic", "CD", "Line", "Master", "Mix"
969 }; 969 };
970 static char *texts8Source[8] = { 970 static const char * const texts8Source[8] = {
971 "Mic", "Mic Master", "CD", "AOUT", 971 "Mic", "Mic Master", "CD", "AOUT",
972 "Mic1", "Mix", "Line", "Master" 972 "Mic1", "Mix", "Line", "Master"
973 }; 973 };
974 struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol); 974 struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol);
975 975
976 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
977 uinfo->count = 1;
978 switch (chip->version) { 976 switch (chip->version) {
979 case 0x1868: 977 case 0x1868:
980 case 0x1878: 978 case 0x1878:
981 uinfo->value.enumerated.items = 4; 979 return snd_ctl_enum_info(uinfo, 1, 4, texts5Source);
982 if (uinfo->value.enumerated.item > 3)
983 uinfo->value.enumerated.item = 3;
984 strcpy(uinfo->value.enumerated.name,
985 texts5Source[uinfo->value.enumerated.item]);
986 break;
987 case 0x1887: 980 case 0x1887:
988 case 0x1888: 981 case 0x1888:
989 uinfo->value.enumerated.items = 5; 982 return snd_ctl_enum_info(uinfo, 1, 5, texts5Source);
990 if (uinfo->value.enumerated.item > 4)
991 uinfo->value.enumerated.item = 4;
992 strcpy(uinfo->value.enumerated.name, texts5Source[uinfo->value.enumerated.item]);
993 break;
994 case 0x1869: /* DS somewhat contradictory for 1869: could be be 5 or 8 */ 983 case 0x1869: /* DS somewhat contradictory for 1869: could be be 5 or 8 */
995 case 0x1879: 984 case 0x1879:
996 uinfo->value.enumerated.items = 8; 985 return snd_ctl_enum_info(uinfo, 1, 8, texts8Source);
997 if (uinfo->value.enumerated.item > 7)
998 uinfo->value.enumerated.item = 7;
999 strcpy(uinfo->value.enumerated.name, texts8Source[uinfo->value.enumerated.item]);
1000 break;
1001 default: 986 default:
1002 return -EINVAL; 987 return -EINVAL;
1003 } 988 }
1004 return 0;
1005} 989}
1006 990
1007static int snd_es18xx_get_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 991static int snd_es18xx_get_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)