ALSA: bt87x: use enum control info helper
authorClemens Ladisch <clemens@ladisch.de>
Mon, 10 Jan 2011 15:27:26 +0000 (16:27 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 10 Jan 2011 15:46:56 +0000 (16:46 +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/bt87x.c

index 37e1b5df5ab8d7b7bbfad9c7dd6afcfd56c537e2..2958a05b5293f240fa6da19de314d8bc6e728f4c 100644 (file)
@@ -637,15 +637,9 @@ static struct snd_kcontrol_new snd_bt87x_capture_boost = {
 static int snd_bt87x_capture_source_info(struct snd_kcontrol *kcontrol,
                                         struct snd_ctl_elem_info *info)
 {
-       static char *texts[3] = {"TV Tuner", "FM", "Mic/Line"};
+       static const char *const texts[3] = {"TV Tuner", "FM", "Mic/Line"};
 
-       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;
+       return snd_ctl_enum_info(info, 1, 3, texts);
 }
 
 static int snd_bt87x_capture_source_get(struct snd_kcontrol *kcontrol,