[alsa-devel] [PATCH 1/2] ASoC: s6000: Use snd_ctl_enum_info()
Takashi Iwai
tiwai at suse.de
Tue Oct 21 12:14:55 CEST 2014
... and reduce the open codes.
Signed-off-by: Takashi Iwai <tiwai at suse.de>
---
sound/soc/s6000/s6105-ipcam.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/sound/soc/s6000/s6105-ipcam.c b/sound/soc/s6000/s6105-ipcam.c
index 3510c01f8a6a..e1e159257b57 100644
--- a/sound/soc/s6000/s6105-ipcam.c
+++ b/sound/soc/s6000/s6105-ipcam.c
@@ -80,16 +80,11 @@ static const struct snd_soc_dapm_route audio_map[] = {
static int output_type_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{
- uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
- uinfo->count = 1;
- uinfo->value.enumerated.items = 2;
- if (uinfo->value.enumerated.item) {
- uinfo->value.enumerated.item = 1;
- strcpy(uinfo->value.enumerated.name, "HPLOUT/HPROUT");
- } else {
- strcpy(uinfo->value.enumerated.name, "HPLOUT/HPLCOM");
- }
- return 0;
+ static const char * const texts[] = {
+ "HPLOUT/HPLCOM", "HPLOUT/HPROUT",
+ };
+
+ return snd_ctl_enum_info(uinfo, 1, 2, texts);
}
static int output_type_get(struct snd_kcontrol *kcontrol,
--
2.1.2
More information about the Alsa-devel
mailing list