]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ALSA: aoa: Use snd_ctl_elem_info()
authorTakashi Iwai <tiwai@suse.de>
Mon, 20 Oct 2014 16:10:39 +0000 (18:10 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 21 Oct 2014 06:08:36 +0000 (08:08 +0200)
... and reduce the open codes.  Also add missing const to text arrays.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/aoa/codecs/onyx.c
sound/aoa/codecs/tas.c

index 401107b85d300afa972a3cdc858311865cd56699..23c371ecfb6b3841a11d4b375c6e53f0c3c83324 100644 (file)
@@ -243,13 +243,7 @@ static int onyx_snd_capture_source_info(struct snd_kcontrol *kcontrol,
 {
        static const char * const texts[] = { "Line-In", "Microphone" };
 
-       uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
-       uinfo->count = 1;
-       uinfo->value.enumerated.items = 2;
-       if (uinfo->value.enumerated.item > 1)
-               uinfo->value.enumerated.item = 1;
-       strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
-       return 0;
+       return snd_ctl_enum_info(uinfo, 1, 2, texts);
 }
 
 static int onyx_snd_capture_source_get(struct snd_kcontrol *kcontrol,
index cf3c6303b7e3ca8e3dba43f00fb3ce934620ab50..364c7c4416e8ba5c22d78a2417759288105ddeaa 100644 (file)
@@ -478,15 +478,9 @@ static struct snd_kcontrol_new drc_switch_control = {
 static int tas_snd_capture_source_info(struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_info *uinfo)
 {
-       static char *texts[] = { "Line-In", "Microphone" };
+       static const char * const texts[] = { "Line-In", "Microphone" };
 
-       uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
-       uinfo->count = 1;
-       uinfo->value.enumerated.items = 2;
-       if (uinfo->value.enumerated.item > 1)
-               uinfo->value.enumerated.item = 1;
-       strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
-       return 0;
+       return snd_ctl_enum_info(uinfo, 1, 2, texts);
 }
 
 static int tas_snd_capture_source_get(struct snd_kcontrol *kcontrol,