aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-10-20 12:14:51 -0400
committerTakashi Iwai <tiwai@suse.de>2014-10-21 02:34:52 -0400
commit6b9e1288a506b4d10c48a67058532c52c5c46240 (patch)
treec634d2bb799acf00afeaaf6304531c302d432928 /sound/isa
parent8edd2d120b6821d6eba9fedd0b17b7a47fbe9181 (diff)
ALSA: sb16: 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/sb/sb16_main.c10
-rw-r--r--sound/isa/sb/sb_mixer.c31
2 files changed, 8 insertions, 33 deletions
diff --git a/sound/isa/sb/sb16_main.c b/sound/isa/sb/sb16_main.c
index 0bbcd4714d28..72b10f4f3e70 100644
--- a/sound/isa/sb/sb16_main.c
+++ b/sound/isa/sb/sb16_main.c
@@ -702,17 +702,11 @@ static int snd_sb16_get_dma_mode(struct snd_sb *chip)
702 702
703static int snd_sb16_dma_control_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 703static int snd_sb16_dma_control_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
704{ 704{
705 static char *texts[3] = { 705 static const char * const texts[3] = {
706 "Auto", "Playback", "Capture" 706 "Auto", "Playback", "Capture"
707 }; 707 };
708 708
709 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 709 return snd_ctl_enum_info(uinfo, 1, 3, texts);
710 uinfo->count = 1;
711 uinfo->value.enumerated.items = 3;
712 if (uinfo->value.enumerated.item > 2)
713 uinfo->value.enumerated.item = 2;
714 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
715 return 0;
716} 710}
717 711
718static int snd_sb16_dma_control_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 712static int snd_sb16_dma_control_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
diff --git a/sound/isa/sb/sb_mixer.c b/sound/isa/sb/sb_mixer.c
index 1ff78ec9f0ac..e403334a19ad 100644
--- a/sound/isa/sb/sb_mixer.c
+++ b/sound/isa/sb/sb_mixer.c
@@ -182,17 +182,11 @@ static int snd_sbmixer_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_
182 182
183static int snd_dt019x_input_sw_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 183static int snd_dt019x_input_sw_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
184{ 184{
185 static const char *texts[5] = { 185 static const char * const texts[5] = {
186 "CD", "Mic", "Line", "Synth", "Master" 186 "CD", "Mic", "Line", "Synth", "Master"
187 }; 187 };
188 188
189 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 189 return snd_ctl_enum_info(uinfo, 1, 5, texts);
190 uinfo->count = 1;
191 uinfo->value.enumerated.items = 5;
192 if (uinfo->value.enumerated.item > 4)
193 uinfo->value.enumerated.item = 4;
194 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
195 return 0;
196} 190}
197 191
198static int snd_dt019x_input_sw_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 192static int snd_dt019x_input_sw_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
@@ -275,18 +269,11 @@ static int snd_dt019x_input_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl
275static int snd_als4k_mono_capture_route_info(struct snd_kcontrol *kcontrol, 269static int snd_als4k_mono_capture_route_info(struct snd_kcontrol *kcontrol,
276 struct snd_ctl_elem_info *uinfo) 270 struct snd_ctl_elem_info *uinfo)
277{ 271{
278 static const char *texts[3] = { 272 static const char * const texts[3] = {
279 "L chan only", "R chan only", "L ch/2 + R ch/2" 273 "L chan only", "R chan only", "L ch/2 + R ch/2"
280 }; 274 };
281 275
282 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 276 return snd_ctl_enum_info(uinfo, 1, 3, texts);
283 uinfo->count = 1;
284 uinfo->value.enumerated.items = 3;
285 if (uinfo->value.enumerated.item > 2)
286 uinfo->value.enumerated.item = 2;
287 strcpy(uinfo->value.enumerated.name,
288 texts[uinfo->value.enumerated.item]);
289 return 0;
290} 277}
291 278
292static int snd_als4k_mono_capture_route_get(struct snd_kcontrol *kcontrol, 279static int snd_als4k_mono_capture_route_get(struct snd_kcontrol *kcontrol,
@@ -335,17 +322,11 @@ static int snd_als4k_mono_capture_route_put(struct snd_kcontrol *kcontrol,
335 322
336static int snd_sb8mixer_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 323static int snd_sb8mixer_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
337{ 324{
338 static const char *texts[3] = { 325 static const char * const texts[3] = {
339 "Mic", "CD", "Line" 326 "Mic", "CD", "Line"
340 }; 327 };
341 328
342 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 329 return snd_ctl_enum_info(uinfo, 1, 3, texts);
343 uinfo->count = 1;
344 uinfo->value.enumerated.items = 3;
345 if (uinfo->value.enumerated.item > 2)
346 uinfo->value.enumerated.item = 2;
347 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
348 return 0;
349} 330}
350 331
351 332