提交 8cea5710 编写于 作者: A Adrian Knoth 提交者: Takashi Iwai

ALSA: hdspm - Refactor ENUMERATED_CTL_INFO into function

ENUMERATED_CTL_INFO is a macro, so the binary code is generated multiple
times. To avoid code duplication, refactor the involved functionality
into a function and make ENUMERATED_CTL_INFO a call to this function.
Signed-off-by: NAdrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
上级 fb0f121e
......@@ -2221,16 +2221,22 @@ static int hdspm_get_s1_sample_rate(struct hdspm *hdspm, unsigned int idx)
return (status >> (idx*4)) & 0xF;
}
#define ENUMERATED_CTL_INFO(info, texts) \
{ \
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]); \
static void snd_hdspm_set_infotext(struct snd_ctl_elem_info *uinfo,
char **texts, const int count)
{
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
uinfo->count = 1;
uinfo->value.enumerated.items = count;
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]);
}
#define ENUMERATED_CTL_INFO(info, texts) \
snd_hdspm_set_infotext(info, texts, ARRAY_SIZE(texts))
#define HDSPM_AUTOSYNC_SAMPLE_RATE(xname, xindex) \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册