Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+4 -18
+4 -18
sound/usb/6fire/control.c
··· 25 25 #include "comm.h" 26 26 #include "chip.h" 27 27 28 - static char *opt_coax_texts[2] = { "Optical", "Coax" }; 29 - static char *line_phono_texts[2] = { "Line", "Phono" }; 28 + static const char * const opt_coax_texts[2] = { "Optical", "Coax" }; 29 + static const char * const line_phono_texts[2] = { "Line", "Phono" }; 30 30 31 31 /* 32 32 * data that needs to be sent to device. sets up card internal stuff. ··· 327 327 static int usb6fire_control_line_phono_info(struct snd_kcontrol *kcontrol, 328 328 struct snd_ctl_elem_info *uinfo) 329 329 { 330 - uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 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; 330 + return snd_ctl_enum_info(uinfo, 1, 2, line_phono_texts); 338 331 } 339 332 340 333 static int usb6fire_control_line_phono_put(struct snd_kcontrol *kcontrol, ··· 354 361 static int usb6fire_control_opt_coax_info(struct snd_kcontrol *kcontrol, 355 362 struct snd_ctl_elem_info *uinfo) 356 363 { 357 - uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 358 - uinfo->count = 1; 359 - uinfo->value.enumerated.items = 2; 360 - if (uinfo->value.enumerated.item > 1) 361 - uinfo->value.enumerated.item = 1; 362 - strcpy(uinfo->value.enumerated.name, 363 - opt_coax_texts[uinfo->value.enumerated.item]); 364 - return 0; 364 + return snd_ctl_enum_info(uinfo, 1, 2, opt_coax_texts); 365 365 } 366 366 367 367 static int usb6fire_control_opt_coax_put(struct snd_kcontrol *kcontrol,