aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa/es1688/es1688.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-09-05 11:19:20 -0400
committerJaroslav Kysela <perex@suse.cz>2005-09-12 04:42:01 -0400
commit43bcd973d6d05d16b876e09dcc49a09d3e48e88d (patch)
tree8c8493b66c417402f6188051c57e55099bbd156d /sound/isa/es1688/es1688.c
parent16dab54b8cbac39bd3f639db5d7d0fd8300a6cb0 (diff)
[ALSA] Add snd_card_set_generic_dev() call to ISA drivers
ISA,CMI8330 driver,ES18xx driver,OPL3SA2 driver,Sound Galaxy driver Sound Scape driver,AD1848 driver,CS4231 driver,CS4236+ driver ES1688 driver,GUS Classic driver,GUS Extreme driver,GUS MAX driver AMD InterWave driver,Opti9xx drivers,SB16/AWE driver,SB8 driver Wavefront drivers - Added snd_card_set_generic_dev() call. - Added SND_GENERIC_DRIVER to Kconfig. - Clean up the error path in probe if necessary. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/isa/es1688/es1688.c')
-rw-r--r--sound/isa/es1688/es1688.c61
1 files changed, 30 insertions, 31 deletions
diff --git a/sound/isa/es1688/es1688.c b/sound/isa/es1688/es1688.c
index c5eaec087b46..26a7d335ed8e 100644
--- a/sound/isa/es1688/es1688.c
+++ b/sound/isa/es1688/es1688.c
@@ -70,6 +70,7 @@ MODULE_PARM_DESC(dma8, "8-bit DMA # for ESx688 driver.");
70 70
71static snd_card_t *snd_audiodrive_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; 71static snd_card_t *snd_audiodrive_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
72 72
73#define PFX "es1688: "
73 74
74static int __init snd_audiodrive_probe(int dev) 75static int __init snd_audiodrive_probe(int dev)
75{ 76{
@@ -89,47 +90,41 @@ static int __init snd_audiodrive_probe(int dev)
89 xirq = irq[dev]; 90 xirq = irq[dev];
90 if (xirq == SNDRV_AUTO_IRQ) { 91 if (xirq == SNDRV_AUTO_IRQ) {
91 if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { 92 if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) {
92 snd_card_free(card); 93 snd_printk(KERN_ERR PFX "unable to find a free IRQ\n");
93 snd_printk("unable to find a free IRQ\n"); 94 err = -EBUSY;
94 return -EBUSY; 95 goto _err;
95 } 96 }
96 } 97 }
97 xmpu_irq = mpu_irq[dev]; 98 xmpu_irq = mpu_irq[dev];
98 xdma = dma8[dev]; 99 xdma = dma8[dev];
99 if (xdma == SNDRV_AUTO_DMA) { 100 if (xdma == SNDRV_AUTO_DMA) {
100 if ((xdma = snd_legacy_find_free_dma(possible_dmas)) < 0) { 101 if ((xdma = snd_legacy_find_free_dma(possible_dmas)) < 0) {
101 snd_card_free(card); 102 snd_printk(KERN_ERR PFX "unable to find a free DMA\n");
102 snd_printk("unable to find a free DMA\n"); 103 err = -EBUSY;
103 return -EBUSY; 104 goto _err;
104 } 105 }
105 } 106 }
106 107
107 if ((err = snd_es1688_create(card, port[dev], mpu_port[dev], 108 if ((err = snd_es1688_create(card, port[dev], mpu_port[dev],
108 xirq, xmpu_irq, xdma, 109 xirq, xmpu_irq, xdma,
109 ES1688_HW_AUTO, &chip)) < 0) { 110 ES1688_HW_AUTO, &chip)) < 0)
110 snd_card_free(card); 111 goto _err;
111 return err; 112
112 } 113 if ((err = snd_es1688_pcm(chip, 0, &pcm)) < 0)
113 if ((err = snd_es1688_pcm(chip, 0, &pcm)) < 0) { 114 goto _err;
114 snd_card_free(card); 115
115 return err; 116 if ((err = snd_es1688_mixer(chip)) < 0)
116 } 117 goto _err;
117 if ((err = snd_es1688_mixer(chip)) < 0) {
118 snd_card_free(card);
119 return err;
120 }
121 118
122 strcpy(card->driver, "ES1688"); 119 strcpy(card->driver, "ES1688");
123 strcpy(card->shortname, pcm->name); 120 strcpy(card->shortname, pcm->name);
124 sprintf(card->longname, "%s at 0x%lx, irq %i, dma %i", pcm->name, chip->port, xirq, xdma); 121 sprintf(card->longname, "%s at 0x%lx, irq %i, dma %i", pcm->name, chip->port, xirq, xdma);
125 122
126 if ((snd_opl3_create(card, chip->port, chip->port + 2, OPL3_HW_OPL3, 0, &opl3)) < 0) { 123 if ((snd_opl3_create(card, chip->port, chip->port + 2, OPL3_HW_OPL3, 0, &opl3)) < 0) {
127 printk(KERN_ERR "es1688: opl3 not detected at 0x%lx\n", chip->port); 124 printk(KERN_WARNING PFX "opl3 not detected at 0x%lx\n", chip->port);
128 } else { 125 } else {
129 if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { 126 if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0)
130 snd_card_free(card); 127 goto _err;
131 return err;
132 }
133 } 128 }
134 129
135 if (xmpu_irq >= 0 && xmpu_irq != SNDRV_AUTO_IRQ && chip->mpu_port > 0) { 130 if (xmpu_irq >= 0 && xmpu_irq != SNDRV_AUTO_IRQ && chip->mpu_port > 0) {
@@ -137,18 +132,22 @@ static int __init snd_audiodrive_probe(int dev)
137 chip->mpu_port, 0, 132 chip->mpu_port, 0,
138 xmpu_irq, 133 xmpu_irq,
139 SA_INTERRUPT, 134 SA_INTERRUPT,
140 NULL)) < 0) { 135 NULL)) < 0)
141 snd_card_free(card); 136 goto _err;
142 return err;
143 }
144 }
145 if ((err = snd_card_register(card)) < 0) {
146 snd_card_free(card);
147 return err;
148 } 137 }
138
139 if ((err = snd_card_set_generic_dev(card)) < 0)
140 goto _err;
141
142 if ((err = snd_card_register(card)) < 0)
143 goto _err;
144
149 snd_audiodrive_cards[dev] = card; 145 snd_audiodrive_cards[dev] = card;
150 return 0; 146 return 0;
151 147
148 _err:
149 snd_card_free(card);
150 return err;
152} 151}
153 152
154static int __init snd_audiodrive_legacy_auto_probe(unsigned long xport) 153static int __init snd_audiodrive_legacy_auto_probe(unsigned long xport)