mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-30 07:36:44 +07:00
ALSA: vx: 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>
This commit is contained in:
parent
6d416f594b
commit
7f471fd407
@ -471,30 +471,18 @@ static struct snd_kcontrol_new vx_control_output_level = {
|
|||||||
*/
|
*/
|
||||||
static int vx_audio_src_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
|
static int vx_audio_src_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
|
||||||
{
|
{
|
||||||
static char *texts_mic[3] = {
|
static const char * const texts_mic[3] = {
|
||||||
"Digital", "Line", "Mic"
|
"Digital", "Line", "Mic"
|
||||||
};
|
};
|
||||||
static char *texts_vx2[2] = {
|
static const char * const texts_vx2[2] = {
|
||||||
"Digital", "Analog"
|
"Digital", "Analog"
|
||||||
};
|
};
|
||||||
struct vx_core *chip = snd_kcontrol_chip(kcontrol);
|
struct vx_core *chip = snd_kcontrol_chip(kcontrol);
|
||||||
|
|
||||||
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
|
if (chip->type >= VX_TYPE_VXPOCKET)
|
||||||
uinfo->count = 1;
|
return snd_ctl_enum_info(uinfo, 1, 3, texts_mic);
|
||||||
if (chip->type >= VX_TYPE_VXPOCKET) {
|
else
|
||||||
uinfo->value.enumerated.items = 3;
|
return snd_ctl_enum_info(uinfo, 1, 2, texts_vx2);
|
||||||
if (uinfo->value.enumerated.item > 2)
|
|
||||||
uinfo->value.enumerated.item = 2;
|
|
||||||
strcpy(uinfo->value.enumerated.name,
|
|
||||||
texts_mic[uinfo->value.enumerated.item]);
|
|
||||||
} else {
|
|
||||||
uinfo->value.enumerated.items = 2;
|
|
||||||
if (uinfo->value.enumerated.item > 1)
|
|
||||||
uinfo->value.enumerated.item = 1;
|
|
||||||
strcpy(uinfo->value.enumerated.name,
|
|
||||||
texts_vx2[uinfo->value.enumerated.item]);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vx_audio_src_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
static int vx_audio_src_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
||||||
@ -539,18 +527,11 @@ static struct snd_kcontrol_new vx_control_audio_src = {
|
|||||||
*/
|
*/
|
||||||
static int vx_clock_mode_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
|
static int vx_clock_mode_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
|
||||||
{
|
{
|
||||||
static char *texts[3] = {
|
static const char * const texts[3] = {
|
||||||
"Auto", "Internal", "External"
|
"Auto", "Internal", "External"
|
||||||
};
|
};
|
||||||
|
|
||||||
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
|
return snd_ctl_enum_info(uinfo, 1, 3, texts);
|
||||||
uinfo->count = 1;
|
|
||||||
uinfo->value.enumerated.items = 3;
|
|
||||||
if (uinfo->value.enumerated.item > 2)
|
|
||||||
uinfo->value.enumerated.item = 2;
|
|
||||||
strcpy(uinfo->value.enumerated.name,
|
|
||||||
texts[uinfo->value.enumerated.item]);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vx_clock_mode_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
static int vx_clock_mode_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
||||||
|
Loading…
Reference in New Issue
Block a user