mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-15 02:05:33 +00:00
ALSA: sb16: Use snd_ctl_enum_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
8edd2d120b
commit
6b9e1288a5
@ -702,17 +702,11 @@ static int snd_sb16_get_dma_mode(struct snd_sb *chip)
|
||||
|
||||
static int snd_sb16_dma_control_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
|
||||
{
|
||||
static char *texts[3] = {
|
||||
static const char * const texts[3] = {
|
||||
"Auto", "Playback", "Capture"
|
||||
};
|
||||
|
||||
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
|
||||
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;
|
||||
return snd_ctl_enum_info(uinfo, 1, 3, texts);
|
||||
}
|
||||
|
||||
static int snd_sb16_dma_control_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
||||
|
@ -182,17 +182,11 @@ static int snd_sbmixer_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_
|
||||
|
||||
static int snd_dt019x_input_sw_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
|
||||
{
|
||||
static const char *texts[5] = {
|
||||
static const char * const texts[5] = {
|
||||
"CD", "Mic", "Line", "Synth", "Master"
|
||||
};
|
||||
|
||||
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
|
||||
uinfo->count = 1;
|
||||
uinfo->value.enumerated.items = 5;
|
||||
if (uinfo->value.enumerated.item > 4)
|
||||
uinfo->value.enumerated.item = 4;
|
||||
strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
|
||||
return 0;
|
||||
return snd_ctl_enum_info(uinfo, 1, 5, texts);
|
||||
}
|
||||
|
||||
static int snd_dt019x_input_sw_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
||||
@ -275,18 +269,11 @@ static int snd_dt019x_input_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl
|
||||
static int snd_als4k_mono_capture_route_info(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_info *uinfo)
|
||||
{
|
||||
static const char *texts[3] = {
|
||||
static const char * const texts[3] = {
|
||||
"L chan only", "R chan only", "L ch/2 + R ch/2"
|
||||
};
|
||||
|
||||
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
|
||||
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;
|
||||
return snd_ctl_enum_info(uinfo, 1, 3, texts);
|
||||
}
|
||||
|
||||
static int snd_als4k_mono_capture_route_get(struct snd_kcontrol *kcontrol,
|
||||
@ -335,17 +322,11 @@ static int snd_als4k_mono_capture_route_put(struct snd_kcontrol *kcontrol,
|
||||
|
||||
static int snd_sb8mixer_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
|
||||
{
|
||||
static const char *texts[3] = {
|
||||
static const char * const texts[3] = {
|
||||
"Mic", "CD", "Line"
|
||||
};
|
||||
|
||||
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
|
||||
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;
|
||||
return snd_ctl_enum_info(uinfo, 1, 3, texts);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user