diff options
author | Takashi Iwai <tiwai@suse.de> | 2012-09-12 09:46:20 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2012-09-12 09:46:20 -0400 |
commit | 1fe4d42e0e28c2c004b06dd590702604f47c2402 (patch) | |
tree | 2599a449eb35ee8e2cb098760d76b9122248de39 | |
parent | 7e8d613b536446139d93c956bb59f25aa934c520 (diff) |
ALSA: ens1370: Reduce ifdefs
... just by defining CHIP_NAME and string concats.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/pci/ens1370.c | 38 |
1 files changed, 8 insertions, 30 deletions
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c index 2ba58d365959..1e615c4d12f8 100644 --- a/sound/pci/ens1370.c +++ b/sound/pci/ens1370.c | |||
@@ -55,8 +55,10 @@ | |||
55 | 55 | ||
56 | #ifdef CHIP1370 | 56 | #ifdef CHIP1370 |
57 | #define DRIVER_NAME "ENS1370" | 57 | #define DRIVER_NAME "ENS1370" |
58 | #define CHIP_NAME "ES1370" /* it can be ENS but just to keep compatibility... */ | ||
58 | #else | 59 | #else |
59 | #define DRIVER_NAME "ENS1371" | 60 | #define DRIVER_NAME "ENS1371" |
61 | #define CHIP_NAME "ES1371" | ||
60 | #endif | 62 | #endif |
61 | 63 | ||
62 | 64 | ||
@@ -1266,11 +1268,7 @@ static int __devinit snd_ensoniq_pcm(struct ensoniq * ensoniq, int device, | |||
1266 | 1268 | ||
1267 | if (rpcm) | 1269 | if (rpcm) |
1268 | *rpcm = NULL; | 1270 | *rpcm = NULL; |
1269 | #ifdef CHIP1370 | 1271 | err = snd_pcm_new(ensoniq->card, CHIP_NAME "/1", device, 1, 1, &pcm); |
1270 | err = snd_pcm_new(ensoniq->card, "ES1370/1", device, 1, 1, &pcm); | ||
1271 | #else | ||
1272 | err = snd_pcm_new(ensoniq->card, "ES1371/1", device, 1, 1, &pcm); | ||
1273 | #endif | ||
1274 | if (err < 0) | 1272 | if (err < 0) |
1275 | return err; | 1273 | return err; |
1276 | 1274 | ||
@@ -1283,11 +1281,7 @@ static int __devinit snd_ensoniq_pcm(struct ensoniq * ensoniq, int device, | |||
1283 | 1281 | ||
1284 | pcm->private_data = ensoniq; | 1282 | pcm->private_data = ensoniq; |
1285 | pcm->info_flags = 0; | 1283 | pcm->info_flags = 0; |
1286 | #ifdef CHIP1370 | 1284 | strcpy(pcm->name, CHIP_NAME " DAC2/ADC"); |
1287 | strcpy(pcm->name, "ES1370 DAC2/ADC"); | ||
1288 | #else | ||
1289 | strcpy(pcm->name, "ES1371 DAC2/ADC"); | ||
1290 | #endif | ||
1291 | ensoniq->pcm1 = pcm; | 1285 | ensoniq->pcm1 = pcm; |
1292 | 1286 | ||
1293 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1287 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
@@ -1306,11 +1300,7 @@ static int __devinit snd_ensoniq_pcm2(struct ensoniq * ensoniq, int device, | |||
1306 | 1300 | ||
1307 | if (rpcm) | 1301 | if (rpcm) |
1308 | *rpcm = NULL; | 1302 | *rpcm = NULL; |
1309 | #ifdef CHIP1370 | 1303 | err = snd_pcm_new(ensoniq->card, CHIP_NAME "/2", device, 1, 0, &pcm); |
1310 | err = snd_pcm_new(ensoniq->card, "ES1370/2", device, 1, 0, &pcm); | ||
1311 | #else | ||
1312 | err = snd_pcm_new(ensoniq->card, "ES1371/2", device, 1, 0, &pcm); | ||
1313 | #endif | ||
1314 | if (err < 0) | 1304 | if (err < 0) |
1315 | return err; | 1305 | return err; |
1316 | 1306 | ||
@@ -1321,11 +1311,7 @@ static int __devinit snd_ensoniq_pcm2(struct ensoniq * ensoniq, int device, | |||
1321 | #endif | 1311 | #endif |
1322 | pcm->private_data = ensoniq; | 1312 | pcm->private_data = ensoniq; |
1323 | pcm->info_flags = 0; | 1313 | pcm->info_flags = 0; |
1324 | #ifdef CHIP1370 | 1314 | strcpy(pcm->name, CHIP_NAME " DAC1"); |
1325 | strcpy(pcm->name, "ES1370 DAC1"); | ||
1326 | #else | ||
1327 | strcpy(pcm->name, "ES1371 DAC1"); | ||
1328 | #endif | ||
1329 | ensoniq->pcm2 = pcm; | 1315 | ensoniq->pcm2 = pcm; |
1330 | 1316 | ||
1331 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1317 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
@@ -1885,11 +1871,7 @@ static void snd_ensoniq_proc_read(struct snd_info_entry *entry, | |||
1885 | { | 1871 | { |
1886 | struct ensoniq *ensoniq = entry->private_data; | 1872 | struct ensoniq *ensoniq = entry->private_data; |
1887 | 1873 | ||
1888 | #ifdef CHIP1370 | 1874 | snd_iprintf(buffer, "Ensoniq AudioPCI " CHIP_NAME "\n\n"); |
1889 | snd_iprintf(buffer, "Ensoniq AudioPCI ES1370\n\n"); | ||
1890 | #else | ||
1891 | snd_iprintf(buffer, "Ensoniq AudioPCI ES1371\n\n"); | ||
1892 | #endif | ||
1893 | snd_iprintf(buffer, "Joystick enable : %s\n", | 1875 | snd_iprintf(buffer, "Joystick enable : %s\n", |
1894 | ensoniq->ctrl & ES_JYSTK_EN ? "on" : "off"); | 1876 | ensoniq->ctrl & ES_JYSTK_EN ? "on" : "off"); |
1895 | #ifdef CHIP1370 | 1877 | #ifdef CHIP1370 |
@@ -2361,11 +2343,7 @@ static int __devinit snd_ensoniq_midi(struct ensoniq * ensoniq, int device, | |||
2361 | *rrawmidi = NULL; | 2343 | *rrawmidi = NULL; |
2362 | if ((err = snd_rawmidi_new(ensoniq->card, "ES1370/1", device, 1, 1, &rmidi)) < 0) | 2344 | if ((err = snd_rawmidi_new(ensoniq->card, "ES1370/1", device, 1, 1, &rmidi)) < 0) |
2363 | return err; | 2345 | return err; |
2364 | #ifdef CHIP1370 | 2346 | strcpy(rmidi->name, CHIP_NAME); |
2365 | strcpy(rmidi->name, "ES1370"); | ||
2366 | #else | ||
2367 | strcpy(rmidi->name, "ES1371"); | ||
2368 | #endif | ||
2369 | snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &snd_ensoniq_midi_output); | 2347 | snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &snd_ensoniq_midi_output); |
2370 | snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, &snd_ensoniq_midi_input); | 2348 | snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, &snd_ensoniq_midi_input); |
2371 | rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT | | 2349 | rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT | |