diff options
author | Takashi Iwai <tiwai@suse.de> | 2014-10-20 12:15:36 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-10-21 02:49:43 -0400 |
commit | 3b7a00dc9e4277d6fcad68dd1db35f77264ede5f (patch) | |
tree | e3e0dd35d1774892e3a2e423c0ad614a5a59fa61 | |
parent | 3c6a73cc6b6ccd9188b3405c744365c0874b9274 (diff) |
ALSA: ac97: 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>
-rw-r--r-- | sound/pci/ac97/ac97_codec.c | 10 | ||||
-rw-r--r-- | sound/pci/ac97/ac97_patch.c | 176 |
2 files changed, 53 insertions, 133 deletions
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index 14ad54b7928c..5ee2f17c287c 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c | |||
@@ -463,14 +463,8 @@ static int snd_ac97_info_enum_double(struct snd_kcontrol *kcontrol, | |||
463 | { | 463 | { |
464 | struct ac97_enum *e = (struct ac97_enum *)kcontrol->private_value; | 464 | struct ac97_enum *e = (struct ac97_enum *)kcontrol->private_value; |
465 | 465 | ||
466 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 466 | return snd_ctl_enum_info(uinfo, e->shift_l == e->shift_r ? 1 : 2, |
467 | uinfo->count = e->shift_l == e->shift_r ? 1 : 2; | 467 | e->mask, e->texts); |
468 | uinfo->value.enumerated.items = e->mask; | ||
469 | |||
470 | if (uinfo->value.enumerated.item > e->mask - 1) | ||
471 | uinfo->value.enumerated.item = e->mask - 1; | ||
472 | strcpy(uinfo->value.enumerated.name, e->texts[uinfo->value.enumerated.item]); | ||
473 | return 0; | ||
474 | } | 468 | } |
475 | 469 | ||
476 | static int snd_ac97_get_enum_double(struct snd_kcontrol *kcontrol, | 470 | static int snd_ac97_get_enum_double(struct snd_kcontrol *kcontrol, |
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c index 991762215417..50f420d69a8a 100644 --- a/sound/pci/ac97/ac97_patch.c +++ b/sound/pci/ac97/ac97_patch.c | |||
@@ -81,22 +81,11 @@ static int ac97_update_bits_page(struct snd_ac97 *ac97, unsigned short reg, unsi | |||
81 | /* | 81 | /* |
82 | * shared line-in/mic controls | 82 | * shared line-in/mic controls |
83 | */ | 83 | */ |
84 | static int ac97_enum_text_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo, | ||
85 | const char **texts, unsigned int nums) | ||
86 | { | ||
87 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | ||
88 | uinfo->count = 1; | ||
89 | uinfo->value.enumerated.items = nums; | ||
90 | if (uinfo->value.enumerated.item > nums - 1) | ||
91 | uinfo->value.enumerated.item = nums - 1; | ||
92 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | ||
93 | return 0; | ||
94 | } | ||
95 | |||
96 | static int ac97_surround_jack_mode_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 84 | static int ac97_surround_jack_mode_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
97 | { | 85 | { |
98 | static const char *texts[] = { "Shared", "Independent" }; | 86 | static const char * const texts[] = { "Shared", "Independent" }; |
99 | return ac97_enum_text_info(kcontrol, uinfo, texts, 2); | 87 | |
88 | return snd_ctl_enum_info(uinfo, 1, 2, texts); | ||
100 | } | 89 | } |
101 | 90 | ||
102 | static int ac97_surround_jack_mode_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 91 | static int ac97_surround_jack_mode_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
@@ -123,9 +112,9 @@ static int ac97_surround_jack_mode_put(struct snd_kcontrol *kcontrol, struct snd | |||
123 | 112 | ||
124 | static int ac97_channel_mode_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 113 | static int ac97_channel_mode_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
125 | { | 114 | { |
126 | static const char *texts[] = { "2ch", "4ch", "6ch", "8ch" }; | 115 | static const char * const texts[] = { "2ch", "4ch", "6ch", "8ch" }; |
127 | return ac97_enum_text_info(kcontrol, uinfo, texts, | 116 | |
128 | kcontrol->private_value); | 117 | return snd_ctl_enum_info(uinfo, 1, kcontrol->private_value, texts); |
129 | } | 118 | } |
130 | 119 | ||
131 | static int ac97_channel_mode_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 120 | static int ac97_channel_mode_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
@@ -240,17 +229,11 @@ static inline int alc850_is_aux_back_surround(struct snd_ac97 *ac97) | |||
240 | static int snd_ac97_ymf7x3_info_speaker(struct snd_kcontrol *kcontrol, | 229 | static int snd_ac97_ymf7x3_info_speaker(struct snd_kcontrol *kcontrol, |
241 | struct snd_ctl_elem_info *uinfo) | 230 | struct snd_ctl_elem_info *uinfo) |
242 | { | 231 | { |
243 | static char *texts[3] = { | 232 | static const char * const texts[3] = { |
244 | "Standard", "Small", "Smaller" | 233 | "Standard", "Small", "Smaller" |
245 | }; | 234 | }; |
246 | 235 | ||
247 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 236 | return snd_ctl_enum_info(uinfo, 1, 3, texts); |
248 | uinfo->count = 1; | ||
249 | uinfo->value.enumerated.items = 3; | ||
250 | if (uinfo->value.enumerated.item > 2) | ||
251 | uinfo->value.enumerated.item = 2; | ||
252 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | ||
253 | return 0; | ||
254 | } | 237 | } |
255 | 238 | ||
256 | static int snd_ac97_ymf7x3_get_speaker(struct snd_kcontrol *kcontrol, | 239 | static int snd_ac97_ymf7x3_get_speaker(struct snd_kcontrol *kcontrol, |
@@ -293,15 +276,9 @@ static const struct snd_kcontrol_new snd_ac97_ymf7x3_controls_speaker = | |||
293 | static int snd_ac97_ymf7x3_spdif_source_info(struct snd_kcontrol *kcontrol, | 276 | static int snd_ac97_ymf7x3_spdif_source_info(struct snd_kcontrol *kcontrol, |
294 | struct snd_ctl_elem_info *uinfo) | 277 | struct snd_ctl_elem_info *uinfo) |
295 | { | 278 | { |
296 | static char *texts[2] = { "AC-Link", "A/D Converter" }; | 279 | static const char * const texts[2] = { "AC-Link", "A/D Converter" }; |
297 | 280 | ||
298 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 281 | return snd_ctl_enum_info(uinfo, 1, 2, texts); |
299 | uinfo->count = 1; | ||
300 | uinfo->value.enumerated.items = 2; | ||
301 | if (uinfo->value.enumerated.item > 1) | ||
302 | uinfo->value.enumerated.item = 1; | ||
303 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | ||
304 | return 0; | ||
305 | } | 282 | } |
306 | 283 | ||
307 | static int snd_ac97_ymf7x3_spdif_source_get(struct snd_kcontrol *kcontrol, | 284 | static int snd_ac97_ymf7x3_spdif_source_get(struct snd_kcontrol *kcontrol, |
@@ -401,15 +378,9 @@ static int patch_yamaha_ymf743(struct snd_ac97 *ac97) | |||
401 | There is also a bit to mute S/PDIF output in a vendor-specific register. */ | 378 | There is also a bit to mute S/PDIF output in a vendor-specific register. */ |
402 | static int snd_ac97_ymf753_spdif_output_pin_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 379 | static int snd_ac97_ymf753_spdif_output_pin_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
403 | { | 380 | { |
404 | static char *texts[3] = { "Disabled", "Pin 43", "Pin 48" }; | 381 | static const char * const texts[3] = { "Disabled", "Pin 43", "Pin 48" }; |
405 | 382 | ||
406 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 383 | return snd_ctl_enum_info(uinfo, 1, 3, texts); |
407 | uinfo->count = 1; | ||
408 | uinfo->value.enumerated.items = 3; | ||
409 | if (uinfo->value.enumerated.item > 2) | ||
410 | uinfo->value.enumerated.item = 2; | ||
411 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | ||
412 | return 0; | ||
413 | } | 384 | } |
414 | 385 | ||
415 | static int snd_ac97_ymf753_spdif_output_pin_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 386 | static int snd_ac97_ymf753_spdif_output_pin_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
@@ -1103,16 +1074,11 @@ static int patch_sigmatel_stac9756(struct snd_ac97 * ac97) | |||
1103 | 1074 | ||
1104 | static int snd_ac97_stac9758_output_jack_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 1075 | static int snd_ac97_stac9758_output_jack_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
1105 | { | 1076 | { |
1106 | static char *texts[5] = { "Input/Disabled", "Front Output", | 1077 | static const char * const texts[5] = { |
1078 | "Input/Disabled", "Front Output", | ||
1107 | "Rear Output", "Center/LFE Output", "Mixer Output" }; | 1079 | "Rear Output", "Center/LFE Output", "Mixer Output" }; |
1108 | 1080 | ||
1109 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 1081 | return snd_ctl_enum_info(uinfo, 1, 5, texts); |
1110 | uinfo->count = 1; | ||
1111 | uinfo->value.enumerated.items = 5; | ||
1112 | if (uinfo->value.enumerated.item > 4) | ||
1113 | uinfo->value.enumerated.item = 4; | ||
1114 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | ||
1115 | return 0; | ||
1116 | } | 1082 | } |
1117 | 1083 | ||
1118 | static int snd_ac97_stac9758_output_jack_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1084 | static int snd_ac97_stac9758_output_jack_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
@@ -1147,16 +1113,11 @@ static int snd_ac97_stac9758_output_jack_put(struct snd_kcontrol *kcontrol, stru | |||
1147 | 1113 | ||
1148 | static int snd_ac97_stac9758_input_jack_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 1114 | static int snd_ac97_stac9758_input_jack_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
1149 | { | 1115 | { |
1150 | static char *texts[7] = { "Mic2 Jack", "Mic1 Jack", "Line In Jack", | 1116 | static const char * const texts[7] = { |
1117 | "Mic2 Jack", "Mic1 Jack", "Line In Jack", | ||
1151 | "Front Jack", "Rear Jack", "Center/LFE Jack", "Mute" }; | 1118 | "Front Jack", "Rear Jack", "Center/LFE Jack", "Mute" }; |
1152 | 1119 | ||
1153 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 1120 | return snd_ctl_enum_info(uinfo, 1, 7, texts); |
1154 | uinfo->count = 1; | ||
1155 | uinfo->value.enumerated.items = 7; | ||
1156 | if (uinfo->value.enumerated.item > 6) | ||
1157 | uinfo->value.enumerated.item = 6; | ||
1158 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | ||
1159 | return 0; | ||
1160 | } | 1121 | } |
1161 | 1122 | ||
1162 | static int snd_ac97_stac9758_input_jack_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1123 | static int snd_ac97_stac9758_input_jack_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
@@ -1181,15 +1142,11 @@ static int snd_ac97_stac9758_input_jack_put(struct snd_kcontrol *kcontrol, struc | |||
1181 | 1142 | ||
1182 | static int snd_ac97_stac9758_phonesel_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 1143 | static int snd_ac97_stac9758_phonesel_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
1183 | { | 1144 | { |
1184 | static char *texts[3] = { "None", "Front Jack", "Rear Jack" }; | 1145 | static const char * const texts[3] = { |
1146 | "None", "Front Jack", "Rear Jack" | ||
1147 | }; | ||
1185 | 1148 | ||
1186 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 1149 | return snd_ctl_enum_info(uinfo, 1, 3, texts); |
1187 | uinfo->count = 1; | ||
1188 | uinfo->value.enumerated.items = 3; | ||
1189 | if (uinfo->value.enumerated.item > 2) | ||
1190 | uinfo->value.enumerated.item = 2; | ||
1191 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | ||
1192 | return 0; | ||
1193 | } | 1150 | } |
1194 | 1151 | ||
1195 | static int snd_ac97_stac9758_phonesel_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1152 | static int snd_ac97_stac9758_phonesel_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
@@ -1804,15 +1761,9 @@ static int patch_ad1886(struct snd_ac97 * ac97) | |||
1804 | 1761 | ||
1805 | static int snd_ac97_ad198x_spdif_source_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 1762 | static int snd_ac97_ad198x_spdif_source_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
1806 | { | 1763 | { |
1807 | static char *texts[2] = { "AC-Link", "A/D Converter" }; | 1764 | static const char * const texts[2] = { "AC-Link", "A/D Converter" }; |
1808 | 1765 | ||
1809 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 1766 | return snd_ctl_enum_info(uinfo, 1, 2, texts); |
1810 | uinfo->count = 1; | ||
1811 | uinfo->value.enumerated.items = 2; | ||
1812 | if (uinfo->value.enumerated.item > 1) | ||
1813 | uinfo->value.enumerated.item = 1; | ||
1814 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | ||
1815 | return 0; | ||
1816 | } | 1767 | } |
1817 | 1768 | ||
1818 | static int snd_ac97_ad198x_spdif_source_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1769 | static int snd_ac97_ad198x_spdif_source_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
@@ -1994,15 +1945,9 @@ static int snd_ac97_ad1888_lohpsel_put(struct snd_kcontrol *kcontrol, struct snd | |||
1994 | 1945 | ||
1995 | static int snd_ac97_ad1888_downmix_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 1946 | static int snd_ac97_ad1888_downmix_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
1996 | { | 1947 | { |
1997 | static char *texts[3] = {"Off", "6 -> 4", "6 -> 2"}; | 1948 | static const char * const texts[3] = {"Off", "6 -> 4", "6 -> 2"}; |
1998 | 1949 | ||
1999 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 1950 | return snd_ctl_enum_info(uinfo, 1, 3, texts); |
2000 | uinfo->count = 1; | ||
2001 | uinfo->value.enumerated.items = 3; | ||
2002 | if (uinfo->value.enumerated.item > 2) | ||
2003 | uinfo->value.enumerated.item = 2; | ||
2004 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | ||
2005 | return 0; | ||
2006 | } | 1951 | } |
2007 | 1952 | ||
2008 | static int snd_ac97_ad1888_downmix_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1953 | static int snd_ac97_ad1888_downmix_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
@@ -2153,16 +2098,11 @@ static int patch_ad1980(struct snd_ac97 * ac97) | |||
2153 | static int snd_ac97_ad1985_vrefout_info(struct snd_kcontrol *kcontrol, | 2098 | static int snd_ac97_ad1985_vrefout_info(struct snd_kcontrol *kcontrol, |
2154 | struct snd_ctl_elem_info *uinfo) | 2099 | struct snd_ctl_elem_info *uinfo) |
2155 | { | 2100 | { |
2156 | static char *texts[4] = {"High-Z", "3.7 V", "2.25 V", "0 V"}; | 2101 | static const char * const texts[4] = { |
2102 | "High-Z", "3.7 V", "2.25 V", "0 V" | ||
2103 | }; | ||
2157 | 2104 | ||
2158 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 2105 | return snd_ctl_enum_info(uinfo, 1, 4, texts); |
2159 | uinfo->count = 1; | ||
2160 | uinfo->value.enumerated.items = 4; | ||
2161 | if (uinfo->value.enumerated.item > 3) | ||
2162 | uinfo->value.enumerated.item = 3; | ||
2163 | strcpy(uinfo->value.enumerated.name, | ||
2164 | texts[uinfo->value.enumerated.item]); | ||
2165 | return 0; | ||
2166 | } | 2106 | } |
2167 | 2107 | ||
2168 | static int snd_ac97_ad1985_vrefout_get(struct snd_kcontrol *kcontrol, | 2108 | static int snd_ac97_ad1985_vrefout_get(struct snd_kcontrol *kcontrol, |
@@ -2756,20 +2696,18 @@ static const struct snd_kcontrol_new snd_ac97_controls_alc655[] = { | |||
2756 | 2696 | ||
2757 | static int alc655_iec958_route_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 2697 | static int alc655_iec958_route_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
2758 | { | 2698 | { |
2759 | static char *texts_655[3] = { "PCM", "Analog In", "IEC958 In" }; | 2699 | static const char * const texts_655[3] = { |
2760 | static char *texts_658[4] = { "PCM", "Analog1 In", "Analog2 In", "IEC958 In" }; | 2700 | "PCM", "Analog In", "IEC958 In" |
2701 | }; | ||
2702 | static const char * const texts_658[4] = { | ||
2703 | "PCM", "Analog1 In", "Analog2 In", "IEC958 In" | ||
2704 | }; | ||
2761 | struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); | 2705 | struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); |
2762 | 2706 | ||
2763 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 2707 | if (ac97->spec.dev_flags) |
2764 | uinfo->count = 1; | 2708 | return snd_ctl_enum_info(uinfo, 1, 4, texts_658); |
2765 | uinfo->value.enumerated.items = ac97->spec.dev_flags ? 4 : 3; | 2709 | else |
2766 | if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) | 2710 | return snd_ctl_enum_info(uinfo, 1, 3, texts_655); |
2767 | uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; | ||
2768 | strcpy(uinfo->value.enumerated.name, | ||
2769 | ac97->spec.dev_flags ? | ||
2770 | texts_658[uinfo->value.enumerated.item] : | ||
2771 | texts_655[uinfo->value.enumerated.item]); | ||
2772 | return 0; | ||
2773 | } | 2711 | } |
2774 | 2712 | ||
2775 | static int alc655_iec958_route_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 2713 | static int alc655_iec958_route_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
@@ -3055,15 +2993,9 @@ static int patch_cm9738(struct snd_ac97 * ac97) | |||
3055 | 2993 | ||
3056 | static int snd_ac97_cmedia_spdif_playback_source_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 2994 | static int snd_ac97_cmedia_spdif_playback_source_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
3057 | { | 2995 | { |
3058 | static char *texts[] = { "Analog", "Digital" }; | 2996 | static const char * const texts[] = { "Analog", "Digital" }; |
3059 | 2997 | ||
3060 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 2998 | return snd_ctl_enum_info(uinfo, 1, 2, texts); |
3061 | uinfo->count = 1; | ||
3062 | uinfo->value.enumerated.items = 2; | ||
3063 | if (uinfo->value.enumerated.item > 1) | ||
3064 | uinfo->value.enumerated.item = 1; | ||
3065 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | ||
3066 | return 0; | ||
3067 | } | 2999 | } |
3068 | 3000 | ||
3069 | static int snd_ac97_cmedia_spdif_playback_source_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 3001 | static int snd_ac97_cmedia_spdif_playback_source_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
@@ -3235,15 +3167,9 @@ static const struct snd_kcontrol_new snd_ac97_cm9761_controls[] = { | |||
3235 | 3167 | ||
3236 | static int cm9761_spdif_out_source_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 3168 | static int cm9761_spdif_out_source_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
3237 | { | 3169 | { |
3238 | static char *texts[] = { "AC-Link", "ADC", "SPDIF-In" }; | 3170 | static const char * const texts[] = { "AC-Link", "ADC", "SPDIF-In" }; |
3239 | 3171 | ||
3240 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 3172 | return snd_ctl_enum_info(uinfo, 1, 3, texts); |
3241 | uinfo->count = 1; | ||
3242 | uinfo->value.enumerated.items = 3; | ||
3243 | if (uinfo->value.enumerated.item > 2) | ||
3244 | uinfo->value.enumerated.item = 2; | ||
3245 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | ||
3246 | return 0; | ||
3247 | } | 3173 | } |
3248 | 3174 | ||
3249 | static int cm9761_spdif_out_source_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 3175 | static int cm9761_spdif_out_source_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
@@ -3552,11 +3478,12 @@ static int snd_ac97_vt1617a_smart51_info(struct snd_kcontrol *kcontrol, | |||
3552 | * is SM51EN *AND* it's Bit14, not Bit15 so the table is very | 3478 | * is SM51EN *AND* it's Bit14, not Bit15 so the table is very |
3553 | * counter-intuitive */ | 3479 | * counter-intuitive */ |
3554 | 3480 | ||
3555 | static const char* texts[] = { "LineIn Mic1", "LineIn Mic1 Mic3", | 3481 | static const char * const texts[] = {"LineIn Mic1", "LineIn Mic1 Mic3", |
3556 | "Surr LFE/C Mic3", "LineIn LFE/C Mic3", | 3482 | "Surr LFE/C Mic3", "LineIn LFE/C Mic3", |
3557 | "LineIn Mic2", "LineIn Mic2 Mic1", | 3483 | "LineIn Mic2", "LineIn Mic2 Mic1", |
3558 | "Surr LFE Mic1", "Surr LFE Mic1 Mic2"}; | 3484 | "Surr LFE Mic1", "Surr LFE Mic1 Mic2"}; |
3559 | return ac97_enum_text_info(kcontrol, uinfo, texts, 8); | 3485 | |
3486 | return snd_ctl_enum_info(uinfo, 1, 8, texts); | ||
3560 | } | 3487 | } |
3561 | 3488 | ||
3562 | static int snd_ac97_vt1617a_smart51_get(struct snd_kcontrol *kcontrol, | 3489 | static int snd_ac97_vt1617a_smart51_get(struct snd_kcontrol *kcontrol, |
@@ -3720,9 +3647,8 @@ static struct vt1618_uaj_item vt1618_uaj[3] = { | |||
3720 | static int snd_ac97_vt1618_UAJ_info(struct snd_kcontrol *kcontrol, | 3647 | static int snd_ac97_vt1618_UAJ_info(struct snd_kcontrol *kcontrol, |
3721 | struct snd_ctl_elem_info *uinfo) | 3648 | struct snd_ctl_elem_info *uinfo) |
3722 | { | 3649 | { |
3723 | return ac97_enum_text_info(kcontrol, uinfo, | 3650 | return snd_ctl_enum_info(uinfo, 1, 4, |
3724 | vt1618_uaj[kcontrol->private_value].items, | 3651 | vt1618_uaj[kcontrol->private_value].items); |
3725 | 4); | ||
3726 | } | 3652 | } |
3727 | 3653 | ||
3728 | /* All of the vt1618 Universal Audio Jack twiddlers are on | 3654 | /* All of the vt1618 Universal Audio Jack twiddlers are on |
@@ -3767,9 +3693,9 @@ static int snd_ac97_vt1618_UAJ_put(struct snd_kcontrol *kcontrol, | |||
3767 | static int snd_ac97_vt1618_aux_info(struct snd_kcontrol *kcontrol, | 3693 | static int snd_ac97_vt1618_aux_info(struct snd_kcontrol *kcontrol, |
3768 | struct snd_ctl_elem_info *uinfo) | 3694 | struct snd_ctl_elem_info *uinfo) |
3769 | { | 3695 | { |
3770 | static const char *txt_aux[] = {"Aux In", "Back Surr Out"}; | 3696 | static const char * const txt_aux[] = {"Aux In", "Back Surr Out"}; |
3771 | 3697 | ||
3772 | return ac97_enum_text_info(kcontrol, uinfo, txt_aux, 2); | 3698 | return snd_ctl_enum_info(uinfo, 1, 2, txt_aux); |
3773 | } | 3699 | } |
3774 | 3700 | ||
3775 | static int snd_ac97_vt1618_aux_get(struct snd_kcontrol *kcontrol, | 3701 | static int snd_ac97_vt1618_aux_get(struct snd_kcontrol *kcontrol, |