From dda415d41882449f841f88d829dd65b6ee1c374c Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 30 Nov 2012 18:34:38 +0100 Subject: ALSA: hda - Add a helper function for simple enum kcontrols The same type of code is being used in multiple places in various codec drivers, so put it as a core library. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_via.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'sound/pci/hda/patch_via.c') diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index 274644f6bd4..dd8cd6af5d6 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c @@ -739,18 +739,7 @@ static void set_pin_power_state(struct hda_codec *codec, hda_nid_t nid, static int via_pin_power_ctl_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { - static const char * const texts[] = { - "Disabled", "Enabled" - }; - - uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; - uinfo->count = 1; - uinfo->value.enumerated.items = 2; - if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) - uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; - strcpy(uinfo->value.enumerated.name, - texts[uinfo->value.enumerated.item]); - return 0; + return snd_hda_enum_bool_helper_info(kcontrol, uinfo); } static int via_pin_power_ctl_get(struct snd_kcontrol *kcontrol, -- cgit v1.2.3-70-g09d2