ALSA: fm801: Use snd_ctl_enum_info()
authorTakashi Iwai <tiwai@suse.de>
Mon, 20 Oct 2014 16:17:17 +0000 (18:17 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 21 Oct 2014 07:00:29 +0000 (09:00 +0200)
... and reduce the open codes.  Also add missing const to the text array.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/fm801.c

index c5038303a126f1706f2f62a1611f6df91de2be1e..d167afffce5fb5dcda4e20abea2df7a8d275682d 100644 (file)
@@ -958,17 +958,11 @@ static int snd_fm801_put_double(struct snd_kcontrol *kcontrol,
 static int snd_fm801_info_mux(struct snd_kcontrol *kcontrol,
                              struct snd_ctl_elem_info *uinfo)
 {
-       static char *texts[5] = {
+       static const char * const texts[5] = {
                "AC97 Primary", "FM", "I2S", "PCM", "AC97 Secondary"
        };
  
-       uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
-       uinfo->count = 1;
-       uinfo->value.enumerated.items = 5;
-       if (uinfo->value.enumerated.item > 4)
-               uinfo->value.enumerated.item = 4;
-       strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
-       return 0;
+       return snd_ctl_enum_info(uinfo, 1, 5, texts);
 }
 
 static int snd_fm801_get_mux(struct snd_kcontrol *kcontrol,