ALSA: ice1724: 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>
このコミットが含まれているのは:
@@ -46,7 +46,7 @@ struct qtet_kcontrol_private {
|
||||
unsigned int bit;
|
||||
void (*set_register)(struct snd_ice1712 *ice, unsigned int val);
|
||||
unsigned int (*get_register)(struct snd_ice1712 *ice);
|
||||
unsigned char * const texts[2];
|
||||
const char * const texts[2];
|
||||
};
|
||||
|
||||
enum {
|
||||
@@ -554,17 +554,7 @@ static int qtet_ain12_enum_info(struct snd_kcontrol *kcontrol,
|
||||
{
|
||||
static const char * const texts[3] =
|
||||
{"Line In 1/2", "Mic", "Mic + Low-cut"};
|
||||
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
|
||||
uinfo->count = 1;
|
||||
uinfo->value.enumerated.items = ARRAY_SIZE(texts);
|
||||
|
||||
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, ARRAY_SIZE(texts), texts);
|
||||
}
|
||||
|
||||
static int qtet_ain12_sw_get(struct snd_kcontrol *kcontrol,
|
||||
@@ -706,17 +696,8 @@ static int qtet_enum_info(struct snd_kcontrol *kcontrol,
|
||||
{
|
||||
struct qtet_kcontrol_private private =
|
||||
qtet_privates[kcontrol->private_value];
|
||||
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
|
||||
uinfo->count = 1;
|
||||
uinfo->value.enumerated.items = ARRAY_SIZE(private.texts);
|
||||
|
||||
if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
|
||||
uinfo->value.enumerated.item =
|
||||
uinfo->value.enumerated.items - 1;
|
||||
strcpy(uinfo->value.enumerated.name,
|
||||
private.texts[uinfo->value.enumerated.item]);
|
||||
|
||||
return 0;
|
||||
return snd_ctl_enum_info(uinfo, 1, ARRAY_SIZE(private.texts),
|
||||
private.texts);
|
||||
}
|
||||
|
||||
static int qtet_sw_get(struct snd_kcontrol *kcontrol,
|
||||
|
新しいイシューから参照
ユーザーをブロックする