diff options
author | Takashi Iwai <tiwai@suse.de> | 2014-10-20 12:19:00 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-10-21 03:04:18 -0400 |
commit | 08455ace3cafd9b0b5c35db3d89c4388f6d3a6fe (patch) | |
tree | 3f667a8f576f21354842027f788871d23edd7635 | |
parent | f861237c80a07449abd351c04a6ba397418dc0ee (diff) |
ALSA: pcxhr: Use snd_ctl_enum_info()
... and reduce the open codes.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/pci/pcxhr/pcxhr_mixer.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/sound/pci/pcxhr/pcxhr_mixer.c b/sound/pci/pcxhr/pcxhr_mixer.c index 95c9571780d8..63136c4f3f3d 100644 --- a/sound/pci/pcxhr/pcxhr_mixer.c +++ b/sound/pci/pcxhr/pcxhr_mixer.c | |||
@@ -660,14 +660,7 @@ static int pcxhr_audio_src_info(struct snd_kcontrol *kcontrol, | |||
660 | if (chip->mgr->board_has_mic) | 660 | if (chip->mgr->board_has_mic) |
661 | i = 5; /* Mic and MicroMix available */ | 661 | i = 5; /* Mic and MicroMix available */ |
662 | } | 662 | } |
663 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 663 | return snd_ctl_enum_info(uinfo, 1, i, texts); |
664 | uinfo->count = 1; | ||
665 | uinfo->value.enumerated.items = i; | ||
666 | if (uinfo->value.enumerated.item > (i-1)) | ||
667 | uinfo->value.enumerated.item = i-1; | ||
668 | strcpy(uinfo->value.enumerated.name, | ||
669 | texts[uinfo->value.enumerated.item]); | ||
670 | return 0; | ||
671 | } | 664 | } |
672 | 665 | ||
673 | static int pcxhr_audio_src_get(struct snd_kcontrol *kcontrol, | 666 | static int pcxhr_audio_src_get(struct snd_kcontrol *kcontrol, |
@@ -756,14 +749,7 @@ static int pcxhr_clock_type_info(struct snd_kcontrol *kcontrol, | |||
756 | texts = textsPCXHR; | 749 | texts = textsPCXHR; |
757 | snd_BUG_ON(clock_items > (PCXHR_CLOCK_TYPE_MAX+1)); | 750 | snd_BUG_ON(clock_items > (PCXHR_CLOCK_TYPE_MAX+1)); |
758 | } | 751 | } |
759 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 752 | return snd_ctl_enum_info(uinfo, 1, clock_items, texts); |
760 | uinfo->count = 1; | ||
761 | uinfo->value.enumerated.items = clock_items; | ||
762 | if (uinfo->value.enumerated.item >= clock_items) | ||
763 | uinfo->value.enumerated.item = clock_items-1; | ||
764 | strcpy(uinfo->value.enumerated.name, | ||
765 | texts[uinfo->value.enumerated.item]); | ||
766 | return 0; | ||
767 | } | 753 | } |
768 | 754 | ||
769 | static int pcxhr_clock_type_get(struct snd_kcontrol *kcontrol, | 755 | static int pcxhr_clock_type_get(struct snd_kcontrol *kcontrol, |