ALSA: ymfpci: use enum control info helper
authorClemens Ladisch <clemens@ladisch.de>
Mon, 10 Jan 2011 15:29:06 +0000 (16:29 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 10 Jan 2011 15:47:03 +0000 (16:47 +0100)
Simplify the info callback by using the snd_ctl_enum_info() helper function.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/ymfpci/ymfpci_main.c

index 5518371db13f25832f566870492eff6215c8e116..c94c051ad0c8576bac2b70f79a12b0442af98f1f 100644 (file)
@@ -1389,15 +1389,9 @@ static struct snd_kcontrol_new snd_ymfpci_spdif_stream __devinitdata =
 
 static int snd_ymfpci_drec_source_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *info)
 {
-       static char *texts[3] = {"AC'97", "IEC958", "ZV Port"};
-
-       info->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
-       info->count = 1;
-       info->value.enumerated.items = 3;
-       if (info->value.enumerated.item > 2)
-               info->value.enumerated.item = 2;
-       strcpy(info->value.enumerated.name, texts[info->value.enumerated.item]);
-       return 0;
+       static const char *const texts[3] = {"AC'97", "IEC958", "ZV Port"};
+
+       return snd_ctl_enum_info(info, 1, 3, texts);
 }
 
 static int snd_ymfpci_drec_source_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *value)