diff options
author | Takashi Iwai <tiwai@suse.de> | 2005-09-05 11:19:20 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2005-09-12 04:42:01 -0400 |
commit | 43bcd973d6d05d16b876e09dcc49a09d3e48e88d (patch) | |
tree | 8c8493b66c417402f6188051c57e55099bbd156d /sound/isa/sgalaxy.c | |
parent | 16dab54b8cbac39bd3f639db5d7d0fd8300a6cb0 (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/sgalaxy.c')
-rw-r--r-- | sound/isa/sgalaxy.c | 65 |
1 files changed, 33 insertions, 32 deletions
diff --git a/sound/isa/sgalaxy.c b/sound/isa/sgalaxy.c index 17f585b0ddc1..52f2294da62b 100644 --- a/sound/isa/sgalaxy.c +++ b/sound/isa/sgalaxy.c | |||
@@ -67,6 +67,8 @@ MODULE_PARM_DESC(dma1, "DMA1 # for Sound Galaxy driver."); | |||
67 | 67 | ||
68 | static snd_card_t *snd_sgalaxy_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; | 68 | static snd_card_t *snd_sgalaxy_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; |
69 | 69 | ||
70 | #define PFX "sgalaxy: " | ||
71 | |||
70 | /* | 72 | /* |
71 | 73 | ||
72 | */ | 74 | */ |
@@ -135,7 +137,7 @@ static int __init snd_sgalaxy_setup_wss(unsigned long port, int irq, int dma) | |||
135 | } | 137 | } |
136 | 138 | ||
137 | #if 0 | 139 | #if 0 |
138 | snd_printdd("sgalaxy - setting up IRQ/DMA for WSS\n"); | 140 | snd_printdd(PFX "setting up IRQ/DMA for WSS\n"); |
139 | #endif | 141 | #endif |
140 | 142 | ||
141 | /* initialize IRQ for WSS codec */ | 143 | /* initialize IRQ for WSS codec */ |
@@ -160,7 +162,7 @@ static int __init snd_sgalaxy_setup_wss(unsigned long port, int irq, int dma) | |||
160 | static int __init snd_sgalaxy_detect(int dev, int irq, int dma) | 162 | static int __init snd_sgalaxy_detect(int dev, int irq, int dma) |
161 | { | 163 | { |
162 | #if 0 | 164 | #if 0 |
163 | snd_printdd("sgalaxy - switching to WSS mode\n"); | 165 | snd_printdd(PFX "switching to WSS mode\n"); |
164 | #endif | 166 | #endif |
165 | 167 | ||
166 | /* switch to WSS mode */ | 168 | /* switch to WSS mode */ |
@@ -223,11 +225,11 @@ static int __init snd_sgalaxy_probe(int dev) | |||
223 | ad1848_t *chip; | 225 | ad1848_t *chip; |
224 | 226 | ||
225 | if (sbport[dev] == SNDRV_AUTO_PORT) { | 227 | if (sbport[dev] == SNDRV_AUTO_PORT) { |
226 | snd_printk("specify SB port\n"); | 228 | snd_printk(KERN_ERR PFX "specify SB port\n"); |
227 | return -EINVAL; | 229 | return -EINVAL; |
228 | } | 230 | } |
229 | if (wssport[dev] == SNDRV_AUTO_PORT) { | 231 | if (wssport[dev] == SNDRV_AUTO_PORT) { |
230 | snd_printk("specify WSS port\n"); | 232 | snd_printk(KERN_ERR PFX "specify WSS port\n"); |
231 | return -EINVAL; | 233 | return -EINVAL; |
232 | } | 234 | } |
233 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 235 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); |
@@ -237,46 +239,39 @@ static int __init snd_sgalaxy_probe(int dev) | |||
237 | xirq = irq[dev]; | 239 | xirq = irq[dev]; |
238 | if (xirq == SNDRV_AUTO_IRQ) { | 240 | if (xirq == SNDRV_AUTO_IRQ) { |
239 | if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { | 241 | if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { |
240 | snd_card_free(card); | 242 | snd_printk(KERN_ERR PFX "unable to find a free IRQ\n"); |
241 | snd_printk("unable to find a free IRQ\n"); | 243 | err = -EBUSY; |
242 | return -EBUSY; | 244 | goto _err; |
243 | } | 245 | } |
244 | } | 246 | } |
245 | xdma1 = dma1[dev]; | 247 | xdma1 = dma1[dev]; |
246 | if (xdma1 == SNDRV_AUTO_DMA) { | 248 | if (xdma1 == SNDRV_AUTO_DMA) { |
247 | if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) { | 249 | if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) { |
248 | snd_card_free(card); | 250 | snd_printk(KERN_ERR PFX "unable to find a free DMA\n"); |
249 | snd_printk("unable to find a free DMA\n"); | 251 | err = -EBUSY; |
250 | return -EBUSY; | 252 | goto _err; |
251 | } | 253 | } |
252 | } | 254 | } |
253 | 255 | ||
254 | if ((err = snd_sgalaxy_detect(dev, xirq, xdma1)) < 0) { | 256 | if ((err = snd_sgalaxy_detect(dev, xirq, xdma1)) < 0) |
255 | snd_card_free(card); | 257 | goto _err; |
256 | return err; | ||
257 | } | ||
258 | 258 | ||
259 | if ((err = snd_ad1848_create(card, wssport[dev] + 4, | 259 | if ((err = snd_ad1848_create(card, wssport[dev] + 4, |
260 | xirq, xdma1, | 260 | xirq, xdma1, |
261 | AD1848_HW_DETECT, &chip)) < 0) { | 261 | AD1848_HW_DETECT, &chip)) < 0) |
262 | snd_card_free(card); | 262 | goto _err; |
263 | return err; | ||
264 | } | ||
265 | 263 | ||
266 | if ((err = snd_ad1848_pcm(chip, 0, NULL)) < 0) { | 264 | if ((err = snd_ad1848_pcm(chip, 0, NULL)) < 0) { |
267 | snd_printdd("sgalaxy - error creating new ad1848 PCM device\n"); | 265 | snd_printdd(PFX "error creating new ad1848 PCM device\n"); |
268 | snd_card_free(card); | 266 | goto _err; |
269 | return err; | ||
270 | } | 267 | } |
271 | if ((err = snd_ad1848_mixer(chip)) < 0) { | 268 | if ((err = snd_ad1848_mixer(chip)) < 0) { |
272 | snd_printdd("sgalaxy - error creating new ad1848 mixer\n"); | 269 | snd_printdd(PFX "error creating new ad1848 mixer\n"); |
273 | snd_card_free(card); | 270 | goto _err; |
274 | return err; | ||
275 | } | 271 | } |
276 | if (snd_sgalaxy_mixer(chip) < 0) { | 272 | if ((err = snd_sgalaxy_mixer(chip)) < 0) { |
277 | snd_printdd("sgalaxy - the mixer rewrite failed\n"); | 273 | snd_printdd(PFX "the mixer rewrite failed\n"); |
278 | snd_card_free(card); | 274 | goto _err; |
279 | return err; | ||
280 | } | 275 | } |
281 | 276 | ||
282 | strcpy(card->driver, "Sound Galaxy"); | 277 | strcpy(card->driver, "Sound Galaxy"); |
@@ -284,12 +279,18 @@ static int __init snd_sgalaxy_probe(int dev) | |||
284 | sprintf(card->longname, "Sound Galaxy at 0x%lx, irq %d, dma %d", | 279 | sprintf(card->longname, "Sound Galaxy at 0x%lx, irq %d, dma %d", |
285 | wssport[dev], xirq, xdma1); | 280 | wssport[dev], xirq, xdma1); |
286 | 281 | ||
287 | if ((err = snd_card_register(card)) < 0) { | 282 | if ((err = snd_card_set_generic_dev(card)) < 0) |
288 | snd_card_free(card); | 283 | goto _err; |
289 | return err; | 284 | |
290 | } | 285 | if ((err = snd_card_register(card)) < 0) |
286 | goto _err; | ||
287 | |||
291 | snd_sgalaxy_cards[dev] = card; | 288 | snd_sgalaxy_cards[dev] = card; |
292 | return 0; | 289 | return 0; |
290 | |||
291 | _err: | ||
292 | snd_card_free(card); | ||
293 | return err; | ||
293 | } | 294 | } |
294 | 295 | ||
295 | static int __init alsa_card_sgalaxy_init(void) | 296 | static int __init alsa_card_sgalaxy_init(void) |