diff options
author | Takashi Iwai <tiwai@suse.de> | 2014-10-20 12:10:39 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-10-21 02:08:36 -0400 |
commit | 04eeb606a8383b306f4bc6991da8231b5f3924b0 (patch) | |
tree | 945d33b8cc10893697608ba4b4192cde78700ca7 /sound/aoa | |
parent | a7e6fb99150ebb2852ebd0e7bad9ce37cc9a79dd (diff) |
ALSA: aoa: Use snd_ctl_elem_info()
... and reduce the open codes. Also add missing const to text arrays.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/aoa')
-rw-r--r-- | sound/aoa/codecs/onyx.c | 8 | ||||
-rw-r--r-- | sound/aoa/codecs/tas.c | 10 |
2 files changed, 3 insertions, 15 deletions
diff --git a/sound/aoa/codecs/onyx.c b/sound/aoa/codecs/onyx.c index 401107b85d30..23c371ecfb6b 100644 --- a/sound/aoa/codecs/onyx.c +++ b/sound/aoa/codecs/onyx.c | |||
@@ -243,13 +243,7 @@ static int onyx_snd_capture_source_info(struct snd_kcontrol *kcontrol, | |||
243 | { | 243 | { |
244 | static const char * const texts[] = { "Line-In", "Microphone" }; | 244 | static const char * const texts[] = { "Line-In", "Microphone" }; |
245 | 245 | ||
246 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 246 | return snd_ctl_enum_info(uinfo, 1, 2, texts); |
247 | uinfo->count = 1; | ||
248 | uinfo->value.enumerated.items = 2; | ||
249 | if (uinfo->value.enumerated.item > 1) | ||
250 | uinfo->value.enumerated.item = 1; | ||
251 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | ||
252 | return 0; | ||
253 | } | 247 | } |
254 | 248 | ||
255 | static int onyx_snd_capture_source_get(struct snd_kcontrol *kcontrol, | 249 | static int onyx_snd_capture_source_get(struct snd_kcontrol *kcontrol, |
diff --git a/sound/aoa/codecs/tas.c b/sound/aoa/codecs/tas.c index cf3c6303b7e3..364c7c4416e8 100644 --- a/sound/aoa/codecs/tas.c +++ b/sound/aoa/codecs/tas.c | |||
@@ -478,15 +478,9 @@ static struct snd_kcontrol_new drc_switch_control = { | |||
478 | static int tas_snd_capture_source_info(struct snd_kcontrol *kcontrol, | 478 | static int tas_snd_capture_source_info(struct snd_kcontrol *kcontrol, |
479 | struct snd_ctl_elem_info *uinfo) | 479 | struct snd_ctl_elem_info *uinfo) |
480 | { | 480 | { |
481 | static char *texts[] = { "Line-In", "Microphone" }; | 481 | static const char * const texts[] = { "Line-In", "Microphone" }; |
482 | 482 | ||
483 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 483 | return snd_ctl_enum_info(uinfo, 1, 2, texts); |
484 | uinfo->count = 1; | ||
485 | uinfo->value.enumerated.items = 2; | ||
486 | if (uinfo->value.enumerated.item > 1) | ||
487 | uinfo->value.enumerated.item = 1; | ||
488 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | ||
489 | return 0; | ||
490 | } | 484 | } |
491 | 485 | ||
492 | static int tas_snd_capture_source_get(struct snd_kcontrol *kcontrol, | 486 | static int tas_snd_capture_source_get(struct snd_kcontrol *kcontrol, |