diff options
author | Takashi Iwai <tiwai@suse.de> | 2014-10-20 12:21:27 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-10-21 03:17:47 -0400 |
commit | c8dd33fc80cd344d28a1f6a7e1f0af1cf7a2ffd1 (patch) | |
tree | 228bd2e0975cfe09318c14a24ece29bd46690e2f /sound/usb | |
parent | 5fe0b0e3ea1c8cb704677ef7e85345bb683f9182 (diff) |
ALSA: 6fire: 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/usb')
-rw-r--r-- | sound/usb/6fire/control.c | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/sound/usb/6fire/control.c b/sound/usb/6fire/control.c index 184e3987ac24..54656eed6e2e 100644 --- a/sound/usb/6fire/control.c +++ b/sound/usb/6fire/control.c | |||
@@ -25,8 +25,8 @@ | |||
25 | #include "comm.h" | 25 | #include "comm.h" |
26 | #include "chip.h" | 26 | #include "chip.h" |
27 | 27 | ||
28 | static char *opt_coax_texts[2] = { "Optical", "Coax" }; | 28 | static const char * const opt_coax_texts[2] = { "Optical", "Coax" }; |
29 | static char *line_phono_texts[2] = { "Line", "Phono" }; | 29 | static const char * const line_phono_texts[2] = { "Line", "Phono" }; |
30 | 30 | ||
31 | /* | 31 | /* |
32 | * data that needs to be sent to device. sets up card internal stuff. | 32 | * data that needs to be sent to device. sets up card internal stuff. |
@@ -327,14 +327,7 @@ static int usb6fire_control_input_vol_get(struct snd_kcontrol *kcontrol, | |||
327 | static int usb6fire_control_line_phono_info(struct snd_kcontrol *kcontrol, | 327 | static int usb6fire_control_line_phono_info(struct snd_kcontrol *kcontrol, |
328 | struct snd_ctl_elem_info *uinfo) | 328 | struct snd_ctl_elem_info *uinfo) |
329 | { | 329 | { |
330 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 330 | return snd_ctl_enum_info(uinfo, 1, 2, line_phono_texts); |
331 | uinfo->count = 1; | ||
332 | uinfo->value.enumerated.items = 2; | ||
333 | if (uinfo->value.enumerated.item > 1) | ||
334 | uinfo->value.enumerated.item = 1; | ||
335 | strcpy(uinfo->value.enumerated.name, | ||
336 | line_phono_texts[uinfo->value.enumerated.item]); | ||
337 | return 0; | ||
338 | } | 331 | } |
339 | 332 | ||
340 | static int usb6fire_control_line_phono_put(struct snd_kcontrol *kcontrol, | 333 | static int usb6fire_control_line_phono_put(struct snd_kcontrol *kcontrol, |
@@ -361,14 +354,7 @@ static int usb6fire_control_line_phono_get(struct snd_kcontrol *kcontrol, | |||
361 | static int usb6fire_control_opt_coax_info(struct snd_kcontrol *kcontrol, | 354 | static int usb6fire_control_opt_coax_info(struct snd_kcontrol *kcontrol, |
362 | struct snd_ctl_elem_info *uinfo) | 355 | struct snd_ctl_elem_info *uinfo) |
363 | { | 356 | { |
364 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 357 | return snd_ctl_enum_info(uinfo, 1, 2, opt_coax_texts); |
365 | uinfo->count = 1; | ||
366 | uinfo->value.enumerated.items = 2; | ||
367 | if (uinfo->value.enumerated.item > 1) | ||
368 | uinfo->value.enumerated.item = 1; | ||
369 | strcpy(uinfo->value.enumerated.name, | ||
370 | opt_coax_texts[uinfo->value.enumerated.item]); | ||
371 | return 0; | ||
372 | } | 358 | } |
373 | 359 | ||
374 | static int usb6fire_control_opt_coax_put(struct snd_kcontrol *kcontrol, | 360 | static int usb6fire_control_opt_coax_put(struct snd_kcontrol *kcontrol, |