diff options
author | Takashi Iwai <tiwai@suse.de> | 2014-10-20 12:11:58 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-10-21 02:12:15 -0400 |
commit | 7f471fd40742a5d87d887375430bf40331cbbcf6 (patch) | |
tree | 78f7144e95d3055af68b22c5982a7e780fefd93c /sound/drivers | |
parent | 6d416f594bf9a290406d267e2627c5286f51ea59 (diff) |
ALSA: vx: Use snd_ctl_elem_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/drivers')
-rw-r--r-- | sound/drivers/vx/vx_mixer.c | 35 |
1 files changed, 8 insertions, 27 deletions
diff --git a/sound/drivers/vx/vx_mixer.c b/sound/drivers/vx/vx_mixer.c index 3b6823fc0606..be9477e30739 100644 --- a/sound/drivers/vx/vx_mixer.c +++ b/sound/drivers/vx/vx_mixer.c | |||
@@ -471,30 +471,18 @@ static struct snd_kcontrol_new vx_control_output_level = { | |||
471 | */ | 471 | */ |
472 | static int vx_audio_src_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 472 | static int vx_audio_src_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
473 | { | 473 | { |
474 | static char *texts_mic[3] = { | 474 | static const char * const texts_mic[3] = { |
475 | "Digital", "Line", "Mic" | 475 | "Digital", "Line", "Mic" |
476 | }; | 476 | }; |
477 | static char *texts_vx2[2] = { | 477 | static const char * const texts_vx2[2] = { |
478 | "Digital", "Analog" | 478 | "Digital", "Analog" |
479 | }; | 479 | }; |
480 | struct vx_core *chip = snd_kcontrol_chip(kcontrol); | 480 | struct vx_core *chip = snd_kcontrol_chip(kcontrol); |
481 | 481 | ||
482 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 482 | if (chip->type >= VX_TYPE_VXPOCKET) |
483 | uinfo->count = 1; | 483 | return snd_ctl_enum_info(uinfo, 1, 3, texts_mic); |
484 | if (chip->type >= VX_TYPE_VXPOCKET) { | 484 | else |
485 | uinfo->value.enumerated.items = 3; | 485 | return snd_ctl_enum_info(uinfo, 1, 2, texts_vx2); |
486 | if (uinfo->value.enumerated.item > 2) | ||
487 | uinfo->value.enumerated.item = 2; | ||
488 | strcpy(uinfo->value.enumerated.name, | ||
489 | texts_mic[uinfo->value.enumerated.item]); | ||
490 | } else { | ||
491 | uinfo->value.enumerated.items = 2; | ||
492 | if (uinfo->value.enumerated.item > 1) | ||
493 | uinfo->value.enumerated.item = 1; | ||
494 | strcpy(uinfo->value.enumerated.name, | ||
495 | texts_vx2[uinfo->value.enumerated.item]); | ||
496 | } | ||
497 | return 0; | ||
498 | } | 486 | } |
499 | 487 | ||
500 | static int vx_audio_src_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 488 | static int vx_audio_src_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
@@ -539,18 +527,11 @@ static struct snd_kcontrol_new vx_control_audio_src = { | |||
539 | */ | 527 | */ |
540 | static int vx_clock_mode_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 528 | static int vx_clock_mode_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
541 | { | 529 | { |
542 | static char *texts[3] = { | 530 | static const char * const texts[3] = { |
543 | "Auto", "Internal", "External" | 531 | "Auto", "Internal", "External" |
544 | }; | 532 | }; |
545 | 533 | ||
546 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 534 | return snd_ctl_enum_info(uinfo, 1, 3, texts); |
547 | uinfo->count = 1; | ||
548 | uinfo->value.enumerated.items = 3; | ||
549 | if (uinfo->value.enumerated.item > 2) | ||
550 | uinfo->value.enumerated.item = 2; | ||
551 | strcpy(uinfo->value.enumerated.name, | ||
552 | texts[uinfo->value.enumerated.item]); | ||
553 | return 0; | ||
554 | } | 535 | } |
555 | 536 | ||
556 | static int vx_clock_mode_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 537 | static int vx_clock_mode_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |