Commit 41be5164 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: bebob: Use snd_ctl_enum_info()

... and reduce the open codes.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent e7ced413
...@@ -352,17 +352,8 @@ static int special_clk_get(struct snd_bebob *bebob, unsigned int *id) ...@@ -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, static int special_clk_ctl_info(struct snd_kcontrol *kctl,
struct snd_ctl_elem_info *einf) struct snd_ctl_elem_info *einf)
{ {
einf->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; return snd_ctl_enum_info(einf, 1, ARRAY_SIZE(special_clk_labels),
einf->count = 1; special_clk_labels);
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;
} }
static int special_clk_ctl_get(struct snd_kcontrol *kctl, static int special_clk_ctl_get(struct snd_kcontrol *kctl,
struct snd_ctl_elem_value *uval) struct snd_ctl_elem_value *uval)
...@@ -444,17 +435,9 @@ static const char *const special_dig_in_iface_labels[] = { ...@@ -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, static int special_dig_in_iface_ctl_info(struct snd_kcontrol *kctl,
struct snd_ctl_elem_info *einf) struct snd_ctl_elem_info *einf)
{ {
einf->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; return snd_ctl_enum_info(einf, 1,
einf->count = 1; ARRAY_SIZE(special_dig_in_iface_labels),
einf->value.enumerated.items = ARRAY_SIZE(special_dig_in_iface_labels); 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;
} }
static int special_dig_in_iface_ctl_get(struct snd_kcontrol *kctl, static int special_dig_in_iface_ctl_get(struct snd_kcontrol *kctl,
struct snd_ctl_elem_value *uval) struct snd_ctl_elem_value *uval)
...@@ -545,17 +528,9 @@ static const char *const special_dig_out_iface_labels[] = { ...@@ -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, static int special_dig_out_iface_ctl_info(struct snd_kcontrol *kctl,
struct snd_ctl_elem_info *einf) struct snd_ctl_elem_info *einf)
{ {
einf->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; return snd_ctl_enum_info(einf, 1,
einf->count = 1; ARRAY_SIZE(special_dig_out_iface_labels),
einf->value.enumerated.items = ARRAY_SIZE(special_dig_out_iface_labels); 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;
} }
static int special_dig_out_iface_ctl_get(struct snd_kcontrol *kctl, static int special_dig_out_iface_ctl_get(struct snd_kcontrol *kctl,
struct snd_ctl_elem_value *uval) struct snd_ctl_elem_value *uval)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment