Commit 1fe4d42e authored by Takashi Iwai's avatar Takashi Iwai

ALSA: ens1370: Reduce ifdefs

... just by defining CHIP_NAME and string concats.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 7e8d613b
...@@ -55,8 +55,10 @@ ...@@ -55,8 +55,10 @@
#ifdef CHIP1370 #ifdef CHIP1370
#define DRIVER_NAME "ENS1370" #define DRIVER_NAME "ENS1370"
#define CHIP_NAME "ES1370" /* it can be ENS but just to keep compatibility... */
#else #else
#define DRIVER_NAME "ENS1371" #define DRIVER_NAME "ENS1371"
#define CHIP_NAME "ES1371"
#endif #endif
...@@ -1266,11 +1268,7 @@ static int __devinit snd_ensoniq_pcm(struct ensoniq * ensoniq, int device, ...@@ -1266,11 +1268,7 @@ static int __devinit snd_ensoniq_pcm(struct ensoniq * ensoniq, int device,
if (rpcm) if (rpcm)
*rpcm = NULL; *rpcm = NULL;
#ifdef CHIP1370 err = snd_pcm_new(ensoniq->card, CHIP_NAME "/1", device, 1, 1, &pcm);
err = snd_pcm_new(ensoniq->card, "ES1370/1", device, 1, 1, &pcm);
#else
err = snd_pcm_new(ensoniq->card, "ES1371/1", device, 1, 1, &pcm);
#endif
if (err < 0) if (err < 0)
return err; return err;
...@@ -1283,11 +1281,7 @@ static int __devinit snd_ensoniq_pcm(struct ensoniq * ensoniq, int device, ...@@ -1283,11 +1281,7 @@ static int __devinit snd_ensoniq_pcm(struct ensoniq * ensoniq, int device,
pcm->private_data = ensoniq; pcm->private_data = ensoniq;
pcm->info_flags = 0; pcm->info_flags = 0;
#ifdef CHIP1370 strcpy(pcm->name, CHIP_NAME " DAC2/ADC");
strcpy(pcm->name, "ES1370 DAC2/ADC");
#else
strcpy(pcm->name, "ES1371 DAC2/ADC");
#endif
ensoniq->pcm1 = pcm; ensoniq->pcm1 = pcm;
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, 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,11 +1300,7 @@ static int __devinit snd_ensoniq_pcm2(struct ensoniq * ensoniq, int device,
if (rpcm) if (rpcm)
*rpcm = NULL; *rpcm = NULL;
#ifdef CHIP1370 err = snd_pcm_new(ensoniq->card, CHIP_NAME "/2", device, 1, 0, &pcm);
err = snd_pcm_new(ensoniq->card, "ES1370/2", device, 1, 0, &pcm);
#else
err = snd_pcm_new(ensoniq->card, "ES1371/2", device, 1, 0, &pcm);
#endif
if (err < 0) if (err < 0)
return err; return err;
...@@ -1321,11 +1311,7 @@ static int __devinit snd_ensoniq_pcm2(struct ensoniq * ensoniq, int device, ...@@ -1321,11 +1311,7 @@ static int __devinit snd_ensoniq_pcm2(struct ensoniq * ensoniq, int device,
#endif #endif
pcm->private_data = ensoniq; pcm->private_data = ensoniq;
pcm->info_flags = 0; pcm->info_flags = 0;
#ifdef CHIP1370 strcpy(pcm->name, CHIP_NAME " DAC1");
strcpy(pcm->name, "ES1370 DAC1");
#else
strcpy(pcm->name, "ES1371 DAC1");
#endif
ensoniq->pcm2 = pcm; ensoniq->pcm2 = pcm;
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, 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,11 +1871,7 @@ static void snd_ensoniq_proc_read(struct snd_info_entry *entry,
{ {
struct ensoniq *ensoniq = entry->private_data; struct ensoniq *ensoniq = entry->private_data;
#ifdef CHIP1370 snd_iprintf(buffer, "Ensoniq AudioPCI " CHIP_NAME "\n\n");
snd_iprintf(buffer, "Ensoniq AudioPCI ES1370\n\n");
#else
snd_iprintf(buffer, "Ensoniq AudioPCI ES1371\n\n");
#endif
snd_iprintf(buffer, "Joystick enable : %s\n", snd_iprintf(buffer, "Joystick enable : %s\n",
ensoniq->ctrl & ES_JYSTK_EN ? "on" : "off"); ensoniq->ctrl & ES_JYSTK_EN ? "on" : "off");
#ifdef CHIP1370 #ifdef CHIP1370
...@@ -2361,11 +2343,7 @@ static int __devinit snd_ensoniq_midi(struct ensoniq * ensoniq, int device, ...@@ -2361,11 +2343,7 @@ static int __devinit snd_ensoniq_midi(struct ensoniq * ensoniq, int device,
*rrawmidi = NULL; *rrawmidi = NULL;
if ((err = snd_rawmidi_new(ensoniq->card, "ES1370/1", device, 1, 1, &rmidi)) < 0) if ((err = snd_rawmidi_new(ensoniq->card, "ES1370/1", device, 1, 1, &rmidi)) < 0)
return err; return err;
#ifdef CHIP1370 strcpy(rmidi->name, CHIP_NAME);
strcpy(rmidi->name, "ES1370");
#else
strcpy(rmidi->name, "ES1371");
#endif
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &snd_ensoniq_midi_output); snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &snd_ensoniq_midi_output);
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, &snd_ensoniq_midi_input); snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, &snd_ensoniq_midi_input);
rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT | rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT |
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment