ALSA: hdspm: Use snd_ctl_enum_info()
authorTakashi Iwai <tiwai@suse.de>
Mon, 20 Oct 2014 16:19:41 +0000 (18:19 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 21 Oct 2014 07:10:58 +0000 (09:10 +0200)
... and reduce the open codes.

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

index 52d86af3ef2d39e05510c7e055f1e6d0dce73239..7f7277bfb66a9d0f55a2f44eeeba73c65d085379 100644 (file)
@@ -2645,18 +2645,7 @@ static int hdspm_set_clock_source(struct hdspm * hdspm, int mode)
 static int snd_hdspm_info_clock_source(struct snd_kcontrol *kcontrol,
                                       struct snd_ctl_elem_info *uinfo)
 {
-       uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
-       uinfo->count = 1;
-       uinfo->value.enumerated.items = 9;
-
-       if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
-               uinfo->value.enumerated.item =
-                   uinfo->value.enumerated.items - 1;
-
-       strcpy(uinfo->value.enumerated.name,
-              texts_freq[uinfo->value.enumerated.item+1]);
-
-       return 0;
+       return snd_ctl_enum_info(uinfo, 1, 9, texts_freq + 1);
 }
 
 static int snd_hdspm_get_clock_source(struct snd_kcontrol *kcontrol,