aboutsummaryrefslogtreecommitdiffstats
path: root/sound/firewire/bebob
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-10-20 18:12:26 +0200
committerTakashi Iwai <tiwai@suse.de>2014-10-21 08:26:55 +0200
commit41be5164ea09c92d551e8007d2543418e40f847a (patch)
treecb057c46cfa58a3d2b9881b04f1eaabebd769b2f /sound/firewire/bebob
parentALSA: bebob: More constify text arrays (diff)
downloadlinux-dev-41be5164ea09c92d551e8007d2543418e40f847a.tar.xz
linux-dev-41be5164ea09c92d551e8007d2543418e40f847a.zip
ALSA: bebob: Use snd_ctl_enum_info()
... and reduce the open codes. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/bebob')
-rw-r--r--sound/firewire/bebob/bebob_maudio.c41
1 files changed, 8 insertions, 33 deletions
diff --git a/sound/firewire/bebob/bebob_maudio.c b/sound/firewire/bebob/bebob_maudio.c
index 34cba8037b36..a422aaa3bb0c 100644
--- a/sound/firewire/bebob/bebob_maudio.c
+++ b/sound/firewire/bebob/bebob_maudio.c
@@ -352,17 +352,8 @@ static int special_clk_get(struct snd_bebob *bebob, unsigned int *id)
static int special_clk_ctl_info(struct snd_kcontrol *kctl,
struct snd_ctl_elem_info *einf)
{
- einf->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
- einf->count = 1;
- einf->value.enumerated.items = ARRAY_SIZE(special_clk_labels);
-
- if (einf->value.enumerated.item >= einf->value.enumerated.items)
- einf->value.enumerated.item = einf->value.enumerated.items - 1;
-
- strcpy(einf->value.enumerated.name,
- special_clk_labels[einf->value.enumerated.item]);
-
- return 0;
+ return snd_ctl_enum_info(einf, 1, ARRAY_SIZE(special_clk_labels),
+ special_clk_labels);
}
static int special_clk_ctl_get(struct snd_kcontrol *kctl,
struct snd_ctl_elem_value *uval)
@@ -444,17 +435,9 @@ static const char *const special_dig_in_iface_labels[] = {
static int special_dig_in_iface_ctl_info(struct snd_kcontrol *kctl,
struct snd_ctl_elem_info *einf)
{
- einf->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
- einf->count = 1;
- einf->value.enumerated.items = ARRAY_SIZE(special_dig_in_iface_labels);
-
- if (einf->value.enumerated.item >= einf->value.enumerated.items)
- einf->value.enumerated.item = einf->value.enumerated.items - 1;
-
- strcpy(einf->value.enumerated.name,
- special_dig_in_iface_labels[einf->value.enumerated.item]);
-
- return 0;
+ return snd_ctl_enum_info(einf, 1,
+ ARRAY_SIZE(special_dig_in_iface_labels),
+ special_dig_in_iface_labels);
}
static int special_dig_in_iface_ctl_get(struct snd_kcontrol *kctl,
struct snd_ctl_elem_value *uval)
@@ -545,17 +528,9 @@ static const char *const special_dig_out_iface_labels[] = {
static int special_dig_out_iface_ctl_info(struct snd_kcontrol *kctl,
struct snd_ctl_elem_info *einf)
{
- einf->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
- einf->count = 1;
- einf->value.enumerated.items = ARRAY_SIZE(special_dig_out_iface_labels);
-
- if (einf->value.enumerated.item >= einf->value.enumerated.items)
- einf->value.enumerated.item = einf->value.enumerated.items - 1;
-
- strcpy(einf->value.enumerated.name,
- special_dig_out_iface_labels[einf->value.enumerated.item]);
-
- return 0;
+ return snd_ctl_enum_info(einf, 1,
+ ARRAY_SIZE(special_dig_out_iface_labels),
+ special_dig_out_iface_labels);
}
static int special_dig_out_iface_ctl_get(struct snd_kcontrol *kctl,
struct snd_ctl_elem_value *uval)