aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/rme9652
diff options
context:
space:
mode:
authorAdrian Knoth <adi@drcomp.erfurt.thur.de>2013-07-05 05:27:59 -0400
committerTakashi Iwai <tiwai@suse.de>2013-07-05 08:50:42 -0400
commit8cea57104273909ab0825df48149840aad9d2b14 (patch)
tree17b1594e64530877cbbc56a9455a63d22038f0c2 /sound/pci/rme9652
parentfb0f121e0f346bec45810a9439e936ae62fd2441 (diff)
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: Adrian Knoth <adi@drcomp.erfurt.thur.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/rme9652')
-rw-r--r--sound/pci/rme9652/hdspm.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index 15f1e7b37c9f..b271853e2e52 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -2221,16 +2221,22 @@ static int hdspm_get_s1_sample_rate(struct hdspm *hdspm, unsigned int idx)
2221 return (status >> (idx*4)) & 0xF; 2221 return (status >> (idx*4)) & 0xF;
2222} 2222}
2223 2223
2224#define ENUMERATED_CTL_INFO(info, texts) \ 2224static void snd_hdspm_set_infotext(struct snd_ctl_elem_info *uinfo,
2225{ \ 2225 char **texts, const int count)
2226 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; \ 2226{
2227 uinfo->count = 1; \ 2227 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2228 uinfo->value.enumerated.items = ARRAY_SIZE(texts); \ 2228 uinfo->count = 1;
2229 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) \ 2229 uinfo->value.enumerated.items = count;
2230 uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; \ 2230 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
2231 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); \ 2231 uinfo->value.enumerated.item =
2232 uinfo->value.enumerated.items - 1;
2233 strcpy(uinfo->value.enumerated.name,
2234 texts[uinfo->value.enumerated.item]);
2232} 2235}
2233 2236
2237#define ENUMERATED_CTL_INFO(info, texts) \
2238 snd_hdspm_set_infotext(info, texts, ARRAY_SIZE(texts))
2239
2234 2240
2235 2241
2236#define HDSPM_AUTOSYNC_SAMPLE_RATE(xname, xindex) \ 2242#define HDSPM_AUTOSYNC_SAMPLE_RATE(xname, xindex) \