ALSA: ice1712: Use snd_ctl_enum_info()
... and reduce the open codes. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
3ff7221932
commit
c4fa251f6f
2 changed files with 6 additions and 37 deletions
|
@ -580,13 +580,7 @@ static int snd_ice1712_ewx_io_sense_info(struct snd_kcontrol *kcontrol, struct s
|
|||
static const char * const texts[2] = {
|
||||
"+4dBu", "-10dBV",
|
||||
};
|
||||
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
|
||||
uinfo->count = 1;
|
||||
uinfo->value.enumerated.items = 2;
|
||||
if (uinfo->value.enumerated.item >= 2)
|
||||
uinfo->value.enumerated.item = 1;
|
||||
strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
|
||||
return 0;
|
||||
return snd_ctl_enum_info(uinfo, 1, 2, texts);
|
||||
}
|
||||
|
||||
static int snd_ice1712_ewx_io_sense_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
||||
|
@ -903,13 +897,7 @@ static int snd_ice1712_6fire_select_input_info(struct snd_kcontrol *kcontrol, st
|
|||
static const char * const texts[4] = {
|
||||
"Internal", "Front Input", "Rear Input", "Wave Table"
|
||||
};
|
||||
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
|
||||
uinfo->count = 1;
|
||||
uinfo->value.enumerated.items = 4;
|
||||
if (uinfo->value.enumerated.item >= 4)
|
||||
uinfo->value.enumerated.item = 1;
|
||||
strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
|
||||
return 0;
|
||||
return snd_ctl_enum_info(uinfo, 1, 4, texts);
|
||||
}
|
||||
|
||||
static int snd_ice1712_6fire_select_input_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
||||
|
|
|
@ -1839,13 +1839,7 @@ static int snd_ice1712_pro_internal_clock_info(struct snd_kcontrol *kcontrol,
|
|||
"96000", /* 12: 7 */
|
||||
"IEC958 Input", /* 13: -- */
|
||||
};
|
||||
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
|
||||
uinfo->count = 1;
|
||||
uinfo->value.enumerated.items = 14;
|
||||
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_ctl_enum_info(uinfo, 1, 14, texts);
|
||||
}
|
||||
|
||||
static int snd_ice1712_pro_internal_clock_get(struct snd_kcontrol *kcontrol,
|
||||
|
@ -1930,13 +1924,7 @@ static int snd_ice1712_pro_internal_clock_default_info(struct snd_kcontrol *kcon
|
|||
"96000", /* 12: 7 */
|
||||
/* "IEC958 Input", 13: -- */
|
||||
};
|
||||
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
|
||||
uinfo->count = 1;
|
||||
uinfo->value.enumerated.items = 13;
|
||||
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_ctl_enum_info(uinfo, 1, 13, texts);
|
||||
}
|
||||
|
||||
static int snd_ice1712_pro_internal_clock_default_get(struct snd_kcontrol *kcontrol,
|
||||
|
@ -2057,15 +2045,8 @@ static int snd_ice1712_pro_route_info(struct snd_kcontrol *kcontrol,
|
|||
"IEC958 In L", "IEC958 In R", /* 9-10 */
|
||||
"Digital Mixer", /* 11 - optional */
|
||||
};
|
||||
|
||||
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
|
||||
uinfo->count = 1;
|
||||
uinfo->value.enumerated.items =
|
||||
snd_ctl_get_ioffidx(kcontrol, &uinfo->id) < 2 ? 12 : 11;
|
||||
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;
|
||||
int num_items = snd_ctl_get_ioffidx(kcontrol, &uinfo->id) < 2 ? 12 : 11;
|
||||
return snd_ctl_enum_info(uinfo, 1, num_items, texts);
|
||||
}
|
||||
|
||||
static int snd_ice1712_pro_route_analog_get(struct snd_kcontrol *kcontrol,
|
||||
|
|
Loading…
Reference in a new issue