aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-10-22 06:19:57 -0400
committerTakashi Iwai <tiwai@suse.de>2014-10-22 06:19:57 -0400
commit930352862e9533fecc42c7ed20798a7c9e3aa874 (patch)
treef234d6eb69c077f898e375aef30c9550dcf069d7 /sound/pci/hda
parentb46882b6eb713245916100ac5b58664cd242a08d (diff)
parent7bbd03e0143b562ff7d96f7e71c016104020b550 (diff)
Merge branch 'topic/enum-info-cleanup' into for-next
this is a series of patches to just convert the plain info callback for enum ctl elements to snd_ctl_elem_info(). Also, it includes the extension of snd_ctl_elem_info(), for catching the unexpected string cut-off and handling the zero items.
Diffstat (limited to 'sound/pci/hda')
-rw-r--r--sound/pci/hda/hda_codec.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 15e0089492f7..259fbeaa37bd 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -2927,16 +2927,8 @@ static int vmaster_mute_mode_info(struct snd_kcontrol *kcontrol,
2927 static const char * const texts[] = { 2927 static const char * const texts[] = {
2928 "On", "Off", "Follow Master" 2928 "On", "Off", "Follow Master"
2929 }; 2929 };
2930 unsigned int index;
2931 2930
2932 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 2931 return snd_ctl_enum_info(uinfo, 1, 3, texts);
2933 uinfo->count = 1;
2934 uinfo->value.enumerated.items = 3;
2935 index = uinfo->value.enumerated.item;
2936 if (index >= 3)
2937 index = 2;
2938 strcpy(uinfo->value.enumerated.name, texts[index]);
2939 return 0;
2940} 2932}
2941 2933
2942static int vmaster_mute_mode_get(struct snd_kcontrol *kcontrol, 2934static int vmaster_mute_mode_get(struct snd_kcontrol *kcontrol,
@@ -5195,14 +5187,7 @@ int snd_hda_enum_helper_info(struct snd_kcontrol *kcontrol,
5195 texts = texts_default; 5187 texts = texts_default;
5196 } 5188 }
5197 5189
5198 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 5190 return snd_ctl_enum_info(uinfo, 1, num_items, texts);
5199 uinfo->count = 1;
5200 uinfo->value.enumerated.items = num_items;
5201 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
5202 uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
5203 strcpy(uinfo->value.enumerated.name,
5204 texts[uinfo->value.enumerated.item]);
5205 return 0;
5206} 5191}
5207EXPORT_SYMBOL_GPL(snd_hda_enum_helper_info); 5192EXPORT_SYMBOL_GPL(snd_hda_enum_helper_info);
5208 5193