aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/isa/Kconfig18
-rw-r--r--sound/isa/ad1848/ad1848.c37
-rw-r--r--sound/isa/cmi8330.c77
-rw-r--r--sound/isa/cs423x/cs4231.c46
-rw-r--r--sound/isa/cs423x/cs4236.c97
-rw-r--r--sound/isa/es1688/es1688.c61
-rw-r--r--sound/isa/es18xx.c81
-rw-r--r--sound/isa/gus/gusclassic.c115
-rw-r--r--sound/isa/gus/gusextreme.c49
-rw-r--r--sound/isa/gus/gusmax.c145
-rw-r--r--sound/isa/gus/interwave.c167
-rw-r--r--sound/isa/opl3sa2.c36
-rw-r--r--sound/isa/opti9xx/opti92x-ad1848.c8
-rw-r--r--sound/isa/sb/sb16.c144
-rw-r--r--sound/isa/sb/sb8.c62
-rw-r--r--sound/isa/sgalaxy.c65
-rw-r--r--sound/isa/sscape.c22
-rw-r--r--sound/isa/wavefront/wavefront.c5
18 files changed, 587 insertions, 648 deletions
diff --git a/sound/isa/Kconfig b/sound/isa/Kconfig
index 5c3948311528..5d6c300ac0d5 100644
--- a/sound/isa/Kconfig
+++ b/sound/isa/Kconfig
@@ -6,12 +6,12 @@ menu "ISA devices"
6config SND_AD1848_LIB 6config SND_AD1848_LIB
7 tristate 7 tristate
8 select SND_PCM 8 select SND_PCM
9 select SND_GENERIC_PM 9 select SND_GENERIC_DRIVER
10 10
11config SND_CS4231_LIB 11config SND_CS4231_LIB
12 tristate 12 tristate
13 select SND_PCM 13 select SND_PCM
14 select SND_GENERIC_PM 14 select SND_GENERIC_DRIVER
15 15
16config SND_AD1816A 16config SND_AD1816A
17 tristate "Analog Devices SoundPort AD1816A" 17 tristate "Analog Devices SoundPort AD1816A"
@@ -97,6 +97,7 @@ config SND_ES1688
97 select SND_OPL3_LIB 97 select SND_OPL3_LIB
98 select SND_MPU401_UART 98 select SND_MPU401_UART
99 select SND_PCM 99 select SND_PCM
100 select SND_GENERIC_DRIVER
100 help 101 help
101 Say Y here to include support for ESS AudioDrive ES688 or 102 Say Y here to include support for ESS AudioDrive ES688 or
102 ES1688 chips. 103 ES1688 chips.
@@ -110,7 +111,7 @@ config SND_ES18XX
110 select SND_OPL3_LIB 111 select SND_OPL3_LIB
111 select SND_MPU401_UART 112 select SND_MPU401_UART
112 select SND_PCM 113 select SND_PCM
113 select SND_GENERIC_PM 114 select SND_GENERIC_DRIVER
114 help 115 help
115 Say Y here to include support for ESS AudioDrive ES18xx chips. 116 Say Y here to include support for ESS AudioDrive ES18xx chips.
116 117
@@ -126,6 +127,7 @@ config SND_GUSCLASSIC
126 select SND_RAWMIDI 127 select SND_RAWMIDI
127 select SND_PCM 128 select SND_PCM
128 select SND_GUS_SYNTH 129 select SND_GUS_SYNTH
130 select SND_GENERIC_DRIVER
129 help 131 help
130 Say Y here to include support for Gravis UltraSound Classic 132 Say Y here to include support for Gravis UltraSound Classic
131 soundcards. 133 soundcards.
@@ -140,6 +142,7 @@ config SND_GUSEXTREME
140 select SND_MPU401_UART 142 select SND_MPU401_UART
141 select SND_PCM 143 select SND_PCM
142 select SND_GUS_SYNTH 144 select SND_GUS_SYNTH
145 select SND_GENERIC_DRIVER
143 help 146 help
144 Say Y here to include support for Gravis UltraSound Extreme 147 Say Y here to include support for Gravis UltraSound Extreme
145 soundcards. 148 soundcards.
@@ -153,6 +156,7 @@ config SND_GUSMAX
153 select SND_RAWMIDI 156 select SND_RAWMIDI
154 select SND_CS4231_LIB 157 select SND_CS4231_LIB
155 select SND_GUS_SYNTH 158 select SND_GUS_SYNTH
159 select SND_GENERIC_DRIVER
156 help 160 help
157 Say Y here to include support for Gravis UltraSound MAX 161 Say Y here to include support for Gravis UltraSound MAX
158 soundcards. 162 soundcards.
@@ -166,7 +170,7 @@ config SND_INTERWAVE
166 select SND_RAWMIDI 170 select SND_RAWMIDI
167 select SND_CS4231_LIB 171 select SND_CS4231_LIB
168 select SND_GUS_SYNTH 172 select SND_GUS_SYNTH
169 select ISAPNP 173 select SND_GENERIC_DRIVER
170 help 174 help
171 Say Y here to include support for AMD InterWave based 175 Say Y here to include support for AMD InterWave based
172 soundcards (Gravis UltraSound Plug & Play, STB SoundRage32, 176 soundcards (Gravis UltraSound Plug & Play, STB SoundRage32,
@@ -181,7 +185,7 @@ config SND_INTERWAVE_STB
181 select SND_RAWMIDI 185 select SND_RAWMIDI
182 select SND_CS4231_LIB 186 select SND_CS4231_LIB
183 select SND_GUS_SYNTH 187 select SND_GUS_SYNTH
184 select ISAPNP 188 select SND_GENERIC_DRIVER
185 help 189 help
186 Say Y here to include support for AMD InterWave based 190 Say Y here to include support for AMD InterWave based
187 soundcards with a TEA6330T bass and treble regulator 191 soundcards with a TEA6330T bass and treble regulator
@@ -224,6 +228,7 @@ config SND_OPTI93X
224 select SND_OPL3_LIB 228 select SND_OPL3_LIB
225 select SND_MPU401_UART 229 select SND_MPU401_UART
226 select SND_PCM 230 select SND_PCM
231 select SND_GENERIC_DRIVER
227 help 232 help
228 Say Y here to include support for soundcards based on Opti 233 Say Y here to include support for soundcards based on Opti
229 82C93x chips. 234 82C93x chips.
@@ -237,6 +242,7 @@ config SND_SB8
237 select SND_OPL3_LIB 242 select SND_OPL3_LIB
238 select SND_RAWMIDI 243 select SND_RAWMIDI
239 select SND_PCM 244 select SND_PCM
245 select SND_GENERIC_DRIVER
240 help 246 help
241 Say Y here to include support for Creative Sound Blaster 1.0/ 247 Say Y here to include support for Creative Sound Blaster 1.0/
242 2.0/Pro (8-bit) or 100% compatible soundcards. 248 2.0/Pro (8-bit) or 100% compatible soundcards.
@@ -250,6 +256,7 @@ config SND_SB16
250 select SND_OPL3_LIB 256 select SND_OPL3_LIB
251 select SND_MPU401_UART 257 select SND_MPU401_UART
252 select SND_PCM 258 select SND_PCM
259 select SND_GENERIC_DRIVER
253 help 260 help
254 Say Y here to include support for Sound Blaster 16 soundcards 261 Say Y here to include support for Sound Blaster 16 soundcards
255 (including the Plug and Play version). 262 (including the Plug and Play version).
@@ -263,6 +270,7 @@ config SND_SBAWE
263 select SND_OPL3_LIB 270 select SND_OPL3_LIB
264 select SND_MPU401_UART 271 select SND_MPU401_UART
265 select SND_PCM 272 select SND_PCM
273 select SND_GENERIC_DRIVER
266 help 274 help
267 Say Y here to include support for Sound Blaster AWE soundcards 275 Say Y here to include support for Sound Blaster AWE soundcards
268 (including the Plug and Play version). 276 (including the Plug and Play version).
diff --git a/sound/isa/ad1848/ad1848.c b/sound/isa/ad1848/ad1848.c
index 8c399340cd72..3ebcc482b07a 100644
--- a/sound/isa/ad1848/ad1848.c
+++ b/sound/isa/ad1848/ad1848.c
@@ -91,35 +91,36 @@ static int __init snd_card_ad1848_probe(int dev)
91 irq[dev], 91 irq[dev],
92 dma1[dev], 92 dma1[dev],
93 thinkpad[dev] ? AD1848_HW_THINKPAD : AD1848_HW_DETECT, 93 thinkpad[dev] ? AD1848_HW_THINKPAD : AD1848_HW_DETECT,
94 &chip)) < 0) { 94 &chip)) < 0)
95 snd_card_free(card); 95 goto _err;
96 return err; 96
97 } 97 if ((err = snd_ad1848_pcm(chip, 0, &pcm)) < 0)
98 goto _err;
99
100 if ((err = snd_ad1848_mixer(chip)) < 0)
101 goto _err;
98 102
99 if ((err = snd_ad1848_pcm(chip, 0, &pcm)) < 0) {
100 snd_card_free(card);
101 return err;
102 }
103 if ((err = snd_ad1848_mixer(chip)) < 0) {
104 snd_card_free(card);
105 return err;
106 }
107 strcpy(card->driver, "AD1848"); 103 strcpy(card->driver, "AD1848");
108 strcpy(card->shortname, pcm->name); 104 strcpy(card->shortname, pcm->name);
109 105
110 sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d", 106 sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d",
111 pcm->name, chip->port, irq[dev], dma1[dev]); 107 pcm->name, chip->port, irq[dev], dma1[dev]);
112 108
113 if (thinkpad[dev]) { 109 if (thinkpad[dev])
114 strcat(card->longname, " [Thinkpad]"); 110 strcat(card->longname, " [Thinkpad]");
115 }
116 111
117 if ((err = snd_card_register(card)) < 0) { 112 if ((err = snd_card_set_generic_dev(card)) < 0)
118 snd_card_free(card); 113 goto _err;
119 return err; 114
120 } 115 if ((err = snd_card_register(card)) < 0)
116 goto _err;
117
121 snd_ad1848_cards[dev] = card; 118 snd_ad1848_cards[dev] = card;
122 return 0; 119 return 0;
120
121 _err:
122 snd_card_free(card);
123 return err;
123} 124}
124 125
125static int __init alsa_card_ad1848_init(void) 126static int __init alsa_card_ad1848_init(void)
diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c
index 1fce8b9f37cf..5252206ea388 100644
--- a/sound/isa/cmi8330.c
+++ b/sound/isa/cmi8330.c
@@ -438,33 +438,37 @@ static int __devinit snd_cmi8330_pcm(snd_card_t *card, struct snd_cmi8330 *chip)
438/* 438/*
439 */ 439 */
440 440
441#ifdef CONFIG_PNP
442#define is_isapnp_selected(dev) isapnp[dev]
443#else
444#define is_isapnp_selected(dev) 0
445#endif
446
447#define PFX "cmi8330: "
448
441static int __devinit snd_cmi8330_probe(int dev, 449static int __devinit snd_cmi8330_probe(int dev,
442 struct pnp_card_link *pcard, 450 struct pnp_card_link *pcard,
443 const struct pnp_card_device_id *pid) 451 const struct pnp_card_device_id *pid)
444{ 452{
445 snd_card_t *card; 453 snd_card_t *card;
446 struct snd_cmi8330 *acard; 454 struct snd_cmi8330 *acard;
447 unsigned long flags;
448 int i, err; 455 int i, err;
449 456
450#ifdef CONFIG_PNP 457 if (! is_isapnp_selected(dev)) {
451 if (!isapnp[dev]) {
452#endif
453 if (wssport[dev] == SNDRV_AUTO_PORT) { 458 if (wssport[dev] == SNDRV_AUTO_PORT) {
454 snd_printk("specify wssport\n"); 459 snd_printk(KERN_ERR PFX "specify wssport\n");
455 return -EINVAL; 460 return -EINVAL;
456 } 461 }
457 if (sbport[dev] == SNDRV_AUTO_PORT) { 462 if (sbport[dev] == SNDRV_AUTO_PORT) {
458 snd_printk("specify sbport\n"); 463 snd_printk(KERN_ERR PFX "specify sbport\n");
459 return -EINVAL; 464 return -EINVAL;
460 } 465 }
461#ifdef CONFIG_PNP
462 } 466 }
463#endif 467
464 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 468 card = snd_card_new(index[dev], id[dev], THIS_MODULE,
465 sizeof(struct snd_cmi8330)); 469 sizeof(struct snd_cmi8330));
466 if (card == NULL) { 470 if (card == NULL) {
467 snd_printk("could not get a new card\n"); 471 snd_printk(KERN_ERR PFX "could not get a new card\n");
468 return -ENOMEM; 472 return -ENOMEM;
469 } 473 }
470 acard = (struct snd_cmi8330 *)card->private_data; 474 acard = (struct snd_cmi8330 *)card->private_data;
@@ -473,9 +477,8 @@ static int __devinit snd_cmi8330_probe(int dev,
473#ifdef CONFIG_PNP 477#ifdef CONFIG_PNP
474 if (isapnp[dev]) { 478 if (isapnp[dev]) {
475 if ((err = snd_cmi8330_pnp(dev, acard, pcard, pid)) < 0) { 479 if ((err = snd_cmi8330_pnp(dev, acard, pcard, pid)) < 0) {
476 snd_printk("PnP detection failed\n"); 480 snd_printk(KERN_ERR PFX "PnP detection failed\n");
477 snd_card_free(card); 481 goto _err;
478 return err;
479 } 482 }
480 snd_card_set_dev(card, &pcard->card->dev); 483 snd_card_set_dev(card, &pcard->card->dev);
481 } 484 }
@@ -487,14 +490,13 @@ static int __devinit snd_cmi8330_probe(int dev,
487 wssdma[dev], 490 wssdma[dev],
488 AD1848_HW_DETECT, 491 AD1848_HW_DETECT,
489 &acard->wss)) < 0) { 492 &acard->wss)) < 0) {
490 snd_printk("(AD1848) device busy??\n"); 493 snd_printk(KERN_ERR PFX "(AD1848) device busy??\n");
491 snd_card_free(card); 494 goto _err;
492 return err;
493 } 495 }
494 if (acard->wss->hardware != AD1848_HW_CMI8330) { 496 if (acard->wss->hardware != AD1848_HW_CMI8330) {
495 snd_printk("(AD1848) not found during probe\n"); 497 snd_printk(KERN_ERR PFX "(AD1848) not found during probe\n");
496 snd_card_free(card); 498 err = -ENODEV;
497 return -ENODEV; 499 goto _err;
498 } 500 }
499 501
500 if ((err = snd_sbdsp_create(card, sbport[dev], 502 if ((err = snd_sbdsp_create(card, sbport[dev],
@@ -503,32 +505,26 @@ static int __devinit snd_cmi8330_probe(int dev,
503 sbdma8[dev], 505 sbdma8[dev],
504 sbdma16[dev], 506 sbdma16[dev],
505 SB_HW_AUTO, &acard->sb)) < 0) { 507 SB_HW_AUTO, &acard->sb)) < 0) {
506 snd_printk("(SB16) device busy??\n"); 508 snd_printk(KERN_ERR PFX "(SB16) device busy??\n");
507 snd_card_free(card); 509 goto _err;
508 return err;
509 } 510 }
510 if (acard->sb->hardware != SB_HW_16) { 511 if (acard->sb->hardware != SB_HW_16) {
511 snd_printk("(SB16) not found during probe\n"); 512 snd_printk(KERN_ERR PFX "(SB16) not found during probe\n");
512 snd_card_free(card); 513 goto _err;
513 return -ENODEV;
514 } 514 }
515 515
516 spin_lock_irqsave(&acard->wss->reg_lock, flags);
517 snd_ad1848_out(acard->wss, AD1848_MISC_INFO, 0x40); /* switch on MODE2 */ 516 snd_ad1848_out(acard->wss, AD1848_MISC_INFO, 0x40); /* switch on MODE2 */
518 for (i = CMI8330_RMUX3D; i <= CMI8330_CDINGAIN; i++) 517 for (i = CMI8330_RMUX3D; i <= CMI8330_CDINGAIN; i++)
519 snd_ad1848_out(acard->wss, i, snd_cmi8330_image[i - CMI8330_RMUX3D]); 518 snd_ad1848_out(acard->wss, i, snd_cmi8330_image[i - CMI8330_RMUX3D]);
520 spin_unlock_irqrestore(&acard->wss->reg_lock, flags);
521 519
522 if ((err = snd_cmi8330_mixer(card, acard)) < 0) { 520 if ((err = snd_cmi8330_mixer(card, acard)) < 0) {
523 snd_printk("failed to create mixers\n"); 521 snd_printk(KERN_ERR PFX "failed to create mixers\n");
524 snd_card_free(card); 522 goto _err;
525 return err;
526 } 523 }
527 524
528 if ((err = snd_cmi8330_pcm(card, acard)) < 0) { 525 if ((err = snd_cmi8330_pcm(card, acard)) < 0) {
529 snd_printk("failed to create pcms\n"); 526 snd_printk(KERN_ERR PFX "failed to create pcms\n");
530 snd_card_free(card); 527 goto _err;
531 return err;
532 } 528 }
533 529
534 strcpy(card->driver, "CMI8330/C3D"); 530 strcpy(card->driver, "CMI8330/C3D");
@@ -539,16 +535,21 @@ static int __devinit snd_cmi8330_probe(int dev,
539 wssirq[dev], 535 wssirq[dev],
540 wssdma[dev]); 536 wssdma[dev]);
541 537
542 if ((err = snd_card_register(card)) < 0) { 538 if ((err = snd_card_set_generic_dev(card)) < 0)
543 snd_card_free(card); 539 goto _err;
544 return err; 540
545 } 541 if ((err = snd_card_register(card)) < 0)
542 goto _err;
546 543
547 if (pcard) 544 if (pcard)
548 pnp_set_card_drvdata(pcard, card); 545 pnp_set_card_drvdata(pcard, card);
549 else 546 else
550 snd_cmi8330_legacy[dev] = card; 547 snd_cmi8330_legacy[dev] = card;
551 return 0; 548 return 0;
549
550 _err:
551 snd_card_free(card);
552 return err;
552} 553}
553 554
554#ifdef CONFIG_PNP 555#ifdef CONFIG_PNP
@@ -594,10 +595,8 @@ static int __init alsa_card_cmi8330_init(void)
594 for (dev = 0; dev < SNDRV_CARDS; dev++) { 595 for (dev = 0; dev < SNDRV_CARDS; dev++) {
595 if (!enable[dev]) 596 if (!enable[dev])
596 continue; 597 continue;
597#ifdef CONFIG_PNP 598 if (is_isapnp_selected(dev))
598 if (isapnp[dev])
599 continue; 599 continue;
600#endif
601 if (snd_cmi8330_probe(dev, NULL, NULL) >= 0) 600 if (snd_cmi8330_probe(dev, NULL, NULL) >= 0)
602 cards++; 601 cards++;
603 } 602 }
diff --git a/sound/isa/cs423x/cs4231.c b/sound/isa/cs423x/cs4231.c
index 7640837659ea..9be5416bcb92 100644
--- a/sound/isa/cs423x/cs4231.c
+++ b/sound/isa/cs423x/cs4231.c
@@ -76,15 +76,15 @@ static int __init snd_card_cs4231_probe(int dev)
76 int err; 76 int err;
77 77
78 if (port[dev] == SNDRV_AUTO_PORT) { 78 if (port[dev] == SNDRV_AUTO_PORT) {
79 snd_printk("specify port\n"); 79 snd_printk(KERN_ERR "specify port\n");
80 return -EINVAL; 80 return -EINVAL;
81 } 81 }
82 if (irq[dev] == SNDRV_AUTO_IRQ) { 82 if (irq[dev] == SNDRV_AUTO_IRQ) {
83 snd_printk("specify irq\n"); 83 snd_printk(KERN_ERR "specify irq\n");
84 return -EINVAL; 84 return -EINVAL;
85 } 85 }
86 if (dma1[dev] == SNDRV_AUTO_DMA) { 86 if (dma1[dev] == SNDRV_AUTO_DMA) {
87 snd_printk("specify dma1\n"); 87 snd_printk(KERN_ERR "specify dma1\n");
88 return -EINVAL; 88 return -EINVAL;
89 } 89 }
90 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 90 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
@@ -96,15 +96,11 @@ static int __init snd_card_cs4231_probe(int dev)
96 dma1[dev], 96 dma1[dev],
97 dma2[dev], 97 dma2[dev],
98 CS4231_HW_DETECT, 98 CS4231_HW_DETECT,
99 0, &chip)) < 0) { 99 0, &chip)) < 0)
100 snd_card_free(card); 100 goto _err;
101 return err;
102 }
103 101
104 if ((err = snd_cs4231_pcm(chip, 0, &pcm)) < 0) { 102 if ((err = snd_cs4231_pcm(chip, 0, &pcm)) < 0)
105 snd_card_free(card); 103 goto _err;
106 return err;
107 }
108 104
109 strcpy(card->driver, "CS4231"); 105 strcpy(card->driver, "CS4231");
110 strcpy(card->shortname, pcm->name); 106 strcpy(card->shortname, pcm->name);
@@ -113,14 +109,10 @@ static int __init snd_card_cs4231_probe(int dev)
113 if (dma2[dev] >= 0) 109 if (dma2[dev] >= 0)
114 sprintf(card->longname + strlen(card->longname), "&%d", dma2[dev]); 110 sprintf(card->longname + strlen(card->longname), "&%d", dma2[dev]);
115 111
116 if ((err = snd_cs4231_mixer(chip)) < 0) { 112 if ((err = snd_cs4231_mixer(chip)) < 0)
117 snd_card_free(card); 113 goto _err;
118 return err; 114 if ((err = snd_cs4231_timer(chip, 0, NULL)) < 0)
119 } 115 goto _err;
120 if ((err = snd_cs4231_timer(chip, 0, NULL)) < 0) {
121 snd_card_free(card);
122 return err;
123 }
124 116
125 if (mpu_port[dev] > 0 && mpu_port[dev] != SNDRV_AUTO_PORT) { 117 if (mpu_port[dev] > 0 && mpu_port[dev] != SNDRV_AUTO_PORT) {
126 if (mpu_irq[dev] == SNDRV_AUTO_IRQ) 118 if (mpu_irq[dev] == SNDRV_AUTO_IRQ)
@@ -130,14 +122,20 @@ static int __init snd_card_cs4231_probe(int dev)
130 mpu_irq[dev], 122 mpu_irq[dev],
131 mpu_irq[dev] >= 0 ? SA_INTERRUPT : 0, 123 mpu_irq[dev] >= 0 ? SA_INTERRUPT : 0,
132 NULL) < 0) 124 NULL) < 0)
133 printk(KERN_ERR "cs4231: MPU401 not detected\n"); 125 printk(KERN_WARNING "cs4231: MPU401 not detected\n");
134 }
135 if ((err = snd_card_register(card)) < 0) {
136 snd_card_free(card);
137 return err;
138 } 126 }
127
128 if ((err = snd_card_set_generic_dev(card)) < 0)
129 goto _err;
130
131 if ((err = snd_card_register(card)) < 0)
132 goto _err;
139 snd_cs4231_cards[dev] = card; 133 snd_cs4231_cards[dev] = card;
140 return 0; 134 return 0;
135
136 _err:
137 snd_card_free(card);
138 return err;
141} 139}
142 140
143static int __init alsa_card_cs4231_init(void) 141static int __init alsa_card_cs4231_init(void)
diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c
index 39f4eff44f5c..d28315dc72f7 100644
--- a/sound/isa/cs423x/cs4236.c
+++ b/sound/isa/cs423x/cs4236.c
@@ -387,6 +387,12 @@ static void snd_card_cs4236_free(snd_card_t *card)
387 } 387 }
388} 388}
389 389
390#ifdef CONFIG_PNP
391#define is_isapnp_selected(dev) isapnp[dev]
392#else
393#define is_isapnp_selected(dev) 0
394#endif
395
390static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard, 396static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard,
391 const struct pnp_card_device_id *pid) 397 const struct pnp_card_device_id *pid)
392{ 398{
@@ -397,20 +403,16 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard,
397 opl3_t *opl3; 403 opl3_t *opl3;
398 int err; 404 int err;
399 405
400#ifdef CONFIG_PNP 406 if (! is_isapnp_selected(dev)) {
401 if (!isapnp[dev]) {
402#endif
403 if (port[dev] == SNDRV_AUTO_PORT) { 407 if (port[dev] == SNDRV_AUTO_PORT) {
404 snd_printk("specify port\n"); 408 snd_printk(KERN_ERR "specify port\n");
405 return -EINVAL; 409 return -EINVAL;
406 } 410 }
407 if (cport[dev] == SNDRV_AUTO_PORT) { 411 if (cport[dev] == SNDRV_AUTO_PORT) {
408 snd_printk("specify cport\n"); 412 snd_printk(KERN_ERR "specify cport\n");
409 return -EINVAL; 413 return -EINVAL;
410 } 414 }
411#ifdef CONFIG_PNP
412 } 415 }
413#endif
414 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 416 card = snd_card_new(index[dev], id[dev], THIS_MODULE,
415 sizeof(struct snd_card_cs4236)); 417 sizeof(struct snd_card_cs4236));
416 if (card == NULL) 418 if (card == NULL)
@@ -421,8 +423,7 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard,
421 if (isapnp[dev]) { 423 if (isapnp[dev]) {
422 if ((err = snd_card_cs4236_pnp(dev, acard, pcard, pid))<0) { 424 if ((err = snd_card_cs4236_pnp(dev, acard, pcard, pid))<0) {
423 printk(KERN_ERR "isapnp detection failed and probing for " IDENT " is not supported\n"); 425 printk(KERN_ERR "isapnp detection failed and probing for " IDENT " is not supported\n");
424 snd_card_free(card); 426 goto _err;
425 return -ENXIO;
426 } 427 }
427 snd_card_set_dev(card, &pcard->card->dev); 428 snd_card_set_dev(card, &pcard->card->dev);
428 } 429 }
@@ -430,8 +431,8 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard,
430 if (sb_port[dev] > 0 && sb_port[dev] != SNDRV_AUTO_PORT) 431 if (sb_port[dev] > 0 && sb_port[dev] != SNDRV_AUTO_PORT)
431 if ((acard->res_sb_port = request_region(sb_port[dev], 16, IDENT " SB")) == NULL) { 432 if ((acard->res_sb_port = request_region(sb_port[dev], 16, IDENT " SB")) == NULL) {
432 printk(KERN_ERR IDENT ": unable to register SB port at 0x%lx\n", sb_port[dev]); 433 printk(KERN_ERR IDENT ": unable to register SB port at 0x%lx\n", sb_port[dev]);
433 snd_card_free(card); 434 err = -EBUSY;
434 return -ENOMEM; 435 goto _err;
435 } 436 }
436 437
437#ifdef CS4232 438#ifdef CS4232
@@ -443,18 +444,14 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard,
443 dma2[dev], 444 dma2[dev],
444 CS4231_HW_DETECT, 445 CS4231_HW_DETECT,
445 0, 446 0,
446 &chip)) < 0) { 447 &chip)) < 0)
447 snd_card_free(card); 448 goto _err;
448 return err; 449
449 } 450 if ((err = snd_cs4231_pcm(chip, 0, &pcm)) < 0)
450 if ((err = snd_cs4231_pcm(chip, 0, &pcm)) < 0) { 451 goto _err;
451 snd_card_free(card); 452
452 return err; 453 if ((err = snd_cs4231_mixer(chip)) < 0)
453 } 454 goto _err;
454 if ((err = snd_cs4231_mixer(chip)) < 0) {
455 snd_card_free(card);
456 return err;
457 }
458 455
459#else /* CS4236 */ 456#else /* CS4236 */
460 if ((err = snd_cs4236_create(card, 457 if ((err = snd_cs4236_create(card,
@@ -465,18 +462,14 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard,
465 dma2[dev], 462 dma2[dev],
466 CS4231_HW_DETECT, 463 CS4231_HW_DETECT,
467 0, 464 0,
468 &chip)) < 0) { 465 &chip)) < 0)
469 snd_card_free(card); 466 goto _err;
470 return err; 467
471 } 468 if ((err = snd_cs4236_pcm(chip, 0, &pcm)) < 0)
472 if ((err = snd_cs4236_pcm(chip, 0, &pcm)) < 0) { 469 goto _err;
473 snd_card_free(card); 470
474 return err; 471 if ((err = snd_cs4236_mixer(chip)) < 0)
475 } 472 goto _err;
476 if ((err = snd_cs4236_mixer(chip)) < 0) {
477 snd_card_free(card);
478 return err;
479 }
480#endif 473#endif
481 strcpy(card->driver, pcm->name); 474 strcpy(card->driver, pcm->name);
482 strcpy(card->shortname, pcm->name); 475 strcpy(card->shortname, pcm->name);
@@ -488,21 +481,17 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard,
488 if (dma2[dev] >= 0) 481 if (dma2[dev] >= 0)
489 sprintf(card->longname + strlen(card->longname), "&%d", dma2[dev]); 482 sprintf(card->longname + strlen(card->longname), "&%d", dma2[dev]);
490 483
491 if ((err = snd_cs4231_timer(chip, 0, NULL)) < 0) { 484 if ((err = snd_cs4231_timer(chip, 0, NULL)) < 0)
492 snd_card_free(card); 485 goto _err;
493 return err;
494 }
495 486
496 if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) { 487 if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) {
497 if (snd_opl3_create(card, 488 if (snd_opl3_create(card,
498 fm_port[dev], fm_port[dev] + 2, 489 fm_port[dev], fm_port[dev] + 2,
499 OPL3_HW_OPL3_CS, 0, &opl3) < 0) { 490 OPL3_HW_OPL3_CS, 0, &opl3) < 0) {
500 printk(KERN_ERR IDENT ": OPL3 not detected\n"); 491 printk(KERN_WARNING IDENT ": OPL3 not detected\n");
501 } else { 492 } else {
502 if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { 493 if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0)
503 snd_card_free(card); 494 goto _err;
504 return err;
505 }
506 } 495 }
507 } 496 }
508 497
@@ -513,17 +502,23 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard,
513 mpu_port[dev], 0, 502 mpu_port[dev], 0,
514 mpu_irq[dev], 503 mpu_irq[dev],
515 mpu_irq[dev] >= 0 ? SA_INTERRUPT : 0, NULL) < 0) 504 mpu_irq[dev] >= 0 ? SA_INTERRUPT : 0, NULL) < 0)
516 printk(KERN_ERR IDENT ": MPU401 not detected\n"); 505 printk(KERN_WARNING IDENT ": MPU401 not detected\n");
517 }
518 if ((err = snd_card_register(card)) < 0) {
519 snd_card_free(card);
520 return err;
521 } 506 }
507
508 if ((err = snd_card_set_generic_dev(card)) < 0)
509 goto _err;
510
511 if ((err = snd_card_register(card)) < 0)
512 goto _err;
522 if (pcard) 513 if (pcard)
523 pnp_set_card_drvdata(pcard, card); 514 pnp_set_card_drvdata(pcard, card);
524 else 515 else
525 snd_cs4236_legacy[dev] = card; 516 snd_cs4236_legacy[dev] = card;
526 return 0; 517 return 0;
518
519 _err:
520 snd_card_free(card);
521 return err;
527} 522}
528 523
529#ifdef CONFIG_PNP 524#ifdef CONFIG_PNP
@@ -569,10 +564,8 @@ static int __init alsa_card_cs423x_init(void)
569 for (dev = 0; dev < SNDRV_CARDS; dev++) { 564 for (dev = 0; dev < SNDRV_CARDS; dev++) {
570 if (!enable[dev]) 565 if (!enable[dev])
571 continue; 566 continue;
572#ifdef CONFIG_PNP 567 if (is_isapnp_selected(dev))
573 if (isapnp[dev])
574 continue; 568 continue;
575#endif
576 if (snd_card_cs423x_probe(dev, NULL, NULL) >= 0) 569 if (snd_card_cs423x_probe(dev, NULL, NULL) >= 0)
577 cards++; 570 cards++;
578 } 571 }
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)
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c
index 1d832b2adb7c..f654d5948367 100644
--- a/sound/isa/es18xx.c
+++ b/sound/isa/es18xx.c
@@ -1988,6 +1988,12 @@ static int __devinit snd_audiodrive_pnp(int dev, struct snd_audiodrive *acard,
1988} 1988}
1989#endif /* CONFIG_PNP */ 1989#endif /* CONFIG_PNP */
1990 1990
1991#ifdef CONFIG_PNP
1992#define is_isapnp_selected(dev) isapnp[dev]
1993#else
1994#define is_isapnp_selected(dev) 0
1995#endif
1996
1991static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard, 1997static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard,
1992 const struct pnp_card_device_id *pid) 1998 const struct pnp_card_device_id *pid)
1993{ 1999{
@@ -1996,7 +2002,6 @@ static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard,
1996 int xirq, xdma1, xdma2; 2002 int xirq, xdma1, xdma2;
1997 snd_card_t *card; 2003 snd_card_t *card;
1998 struct snd_audiodrive *acard; 2004 struct snd_audiodrive *acard;
1999 snd_rawmidi_t *rmidi = NULL;
2000 es18xx_t *chip; 2005 es18xx_t *chip;
2001 opl3_t *opl3; 2006 opl3_t *opl3;
2002 int err; 2007 int err;
@@ -2019,25 +2024,25 @@ static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard,
2019 xirq = irq[dev]; 2024 xirq = irq[dev];
2020 if (xirq == SNDRV_AUTO_IRQ) { 2025 if (xirq == SNDRV_AUTO_IRQ) {
2021 if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { 2026 if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) {
2022 snd_card_free(card); 2027 snd_printk(KERN_ERR PFX "unable to find a free IRQ\n");
2023 snd_printk("unable to find a free IRQ\n"); 2028 err = -EBUSY;
2024 return -EBUSY; 2029 goto _err;
2025 } 2030 }
2026 } 2031 }
2027 xdma1 = dma1[dev]; 2032 xdma1 = dma1[dev];
2028 if (xdma1 == SNDRV_AUTO_DMA) { 2033 if (xdma1 == SNDRV_AUTO_DMA) {
2029 if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) { 2034 if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
2030 snd_card_free(card); 2035 snd_printk(KERN_ERR PFX "unable to find a free DMA1\n");
2031 snd_printk("unable to find a free DMA1\n"); 2036 err = -EBUSY;
2032 return -EBUSY; 2037 goto _err;
2033 } 2038 }
2034 } 2039 }
2035 xdma2 = dma2[dev]; 2040 xdma2 = dma2[dev];
2036 if (xdma2 == SNDRV_AUTO_DMA) { 2041 if (xdma2 == SNDRV_AUTO_DMA) {
2037 if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) { 2042 if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
2038 snd_card_free(card); 2043 snd_printk(KERN_ERR PFX "unable to find a free DMA2\n");
2039 snd_printk("unable to find a free DMA2\n"); 2044 err = -EBUSY;
2040 return -EBUSY; 2045 goto _err;
2041 } 2046 }
2042 } 2047 }
2043 2048
@@ -2046,10 +2051,8 @@ static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard,
2046 mpu_port[dev], 2051 mpu_port[dev],
2047 fm_port[dev], 2052 fm_port[dev],
2048 xirq, xdma1, xdma2, 2053 xirq, xdma1, xdma2,
2049 &chip)) < 0) { 2054 &chip)) < 0)
2050 snd_card_free(card); 2055 goto _err;
2051 return err;
2052 }
2053 2056
2054 sprintf(card->driver, "ES%x", chip->version); 2057 sprintf(card->driver, "ES%x", chip->version);
2055 sprintf(card->shortname, "ESS AudioDrive ES%x", chip->version); 2058 sprintf(card->shortname, "ESS AudioDrive ES%x", chip->version);
@@ -2064,23 +2067,18 @@ static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard,
2064 chip->port, 2067 chip->port,
2065 xirq, xdma1); 2068 xirq, xdma1);
2066 2069
2067 if ((err = snd_es18xx_pcm(chip, 0, NULL)) < 0) { 2070 if ((err = snd_es18xx_pcm(chip, 0, NULL)) < 0)
2068 snd_card_free(card); 2071 goto _err;
2069 return err; 2072
2070 } 2073 if ((err = snd_es18xx_mixer(chip)) < 0)
2071 if ((err = snd_es18xx_mixer(chip)) < 0) { 2074 goto _err;
2072 snd_card_free(card);
2073 return err;
2074 }
2075 2075
2076 if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) { 2076 if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) {
2077 if (snd_opl3_create(card, chip->fm_port, chip->fm_port + 2, OPL3_HW_OPL3, 0, &opl3) < 0) { 2077 if (snd_opl3_create(card, chip->fm_port, chip->fm_port + 2, OPL3_HW_OPL3, 0, &opl3) < 0) {
2078 snd_printk(KERN_ERR PFX "opl3 not detected at 0x%lx\n", chip->fm_port); 2078 snd_printk(KERN_WARNING PFX "opl3 not detected at 0x%lx\n", chip->fm_port);
2079 } else { 2079 } else {
2080 if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { 2080 if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0)
2081 snd_card_free(card); 2081 goto _err;
2082 return err;
2083 }
2084 } 2082 }
2085 } 2083 }
2086 2084
@@ -2088,25 +2086,28 @@ static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard,
2088 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_ES18XX, 2086 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_ES18XX,
2089 chip->mpu_port, 0, 2087 chip->mpu_port, 0,
2090 xirq, 0, 2088 xirq, 0,
2091 &rmidi)) < 0) { 2089 &chip->rmidi)) < 0)
2092 snd_card_free(card); 2090 goto _err;
2093 return err;
2094 }
2095 chip->rmidi = rmidi;
2096 } 2091 }
2097 2092
2093 if ((err = snd_card_set_generic_dev(card)) < 0)
2094 goto _err;
2095
2098 /* Power Management */ 2096 /* Power Management */
2099 snd_card_set_isa_pm_callback(card, snd_es18xx_suspend, snd_es18xx_resume, chip); 2097 snd_card_set_isa_pm_callback(card, snd_es18xx_suspend, snd_es18xx_resume, chip);
2100 2098
2101 if ((err = snd_card_register(card)) < 0) { 2099 if ((err = snd_card_register(card)) < 0)
2102 snd_card_free(card); 2100 goto _err;
2103 return err; 2101
2104 }
2105 if (pcard) 2102 if (pcard)
2106 pnp_set_card_drvdata(pcard, card); 2103 pnp_set_card_drvdata(pcard, card);
2107 else 2104 else
2108 snd_audiodrive_legacy[dev] = card; 2105 snd_audiodrive_legacy[dev] = card;
2109 return 0; 2106 return 0;
2107
2108 _err:
2109 snd_card_free(card);
2110 return err;
2110} 2111}
2111 2112
2112static int __devinit snd_audiodrive_probe_legacy_port(unsigned long xport) 2113static int __devinit snd_audiodrive_probe_legacy_port(unsigned long xport)
@@ -2117,10 +2118,8 @@ static int __devinit snd_audiodrive_probe_legacy_port(unsigned long xport)
2117 for ( ; dev < SNDRV_CARDS; dev++) { 2118 for ( ; dev < SNDRV_CARDS; dev++) {
2118 if (!enable[dev] || port[dev] != SNDRV_AUTO_PORT) 2119 if (!enable[dev] || port[dev] != SNDRV_AUTO_PORT)
2119 continue; 2120 continue;
2120#ifdef CONFIG_PNP 2121 if (is_isapnp_selected(dev))
2121 if (isapnp[dev])
2122 continue; 2122 continue;
2123#endif
2124 port[dev] = xport; 2123 port[dev] = xport;
2125 res = snd_audiodrive_probe(dev, NULL, NULL); 2124 res = snd_audiodrive_probe(dev, NULL, NULL);
2126 if (res < 0) 2125 if (res < 0)
@@ -2177,10 +2176,8 @@ static int __init alsa_card_es18xx_init(void)
2177 for (dev = 0; dev < SNDRV_CARDS; dev++) { 2176 for (dev = 0; dev < SNDRV_CARDS; dev++) {
2178 if (!enable[dev] || port[dev] == SNDRV_AUTO_PORT) 2177 if (!enable[dev] || port[dev] == SNDRV_AUTO_PORT)
2179 continue; 2178 continue;
2180#ifdef CONFIG_PNP 2179 if (is_isapnp_selected(dev))
2181 if (isapnp[dev])
2182 continue; 2180 continue;
2183#endif
2184 if (snd_audiodrive_probe(dev, NULL, NULL) >= 0) 2181 if (snd_audiodrive_probe(dev, NULL, NULL) >= 0)
2185 cards++; 2182 cards++;
2186 } 2183 }
diff --git a/sound/isa/gus/gusclassic.c b/sound/isa/gus/gusclassic.c
index a99fa5040b46..39cef38835ca 100644
--- a/sound/isa/gus/gusclassic.c
+++ b/sound/isa/gus/gusclassic.c
@@ -72,40 +72,24 @@ MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for GUS Classic driver.");
72 72
73static snd_card_t *snd_gusclassic_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; 73static snd_card_t *snd_gusclassic_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
74 74
75#define PFX "gusclassic: "
75 76
76static int __init snd_gusclassic_detect(snd_gus_card_t * gus) 77static int __init snd_gusclassic_detect(snd_gus_card_t * gus)
77{ 78{
78 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0); /* reset GF1 */ 79 unsigned char d;
79#ifdef CONFIG_SND_DEBUG_DETECT
80 {
81 unsigned char d;
82 80
83 if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) { 81 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0); /* reset GF1 */
84 snd_printk("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d); 82 if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) {
85 return -ENODEV; 83 snd_printdd("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d);
86 }
87 }
88#else
89 if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 0)
90 return -ENODEV; 84 return -ENODEV;
91#endif 85 }
92 udelay(160); 86 udelay(160);
93 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1); /* release reset */ 87 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1); /* release reset */
94 udelay(160); 88 udelay(160);
95#ifdef CONFIG_SND_DEBUG_DETECT 89 if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
96 { 90 snd_printdd("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
97 unsigned char d;
98
99 if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
100 snd_printk("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
101 return -ENODEV;
102 }
103 }
104#else
105 if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 1)
106 return -ENODEV; 91 return -ENODEV;
107#endif 92 }
108
109 return 0; 93 return 0;
110} 94}
111 95
@@ -137,25 +121,25 @@ static int __init snd_gusclassic_probe(int dev)
137 xirq = irq[dev]; 121 xirq = irq[dev];
138 if (xirq == SNDRV_AUTO_IRQ) { 122 if (xirq == SNDRV_AUTO_IRQ) {
139 if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { 123 if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) {
140 snd_card_free(card); 124 snd_printk(KERN_ERR PFX "unable to find a free IRQ\n");
141 snd_printk("unable to find a free IRQ\n"); 125 err = -EBUSY;
142 return -EBUSY; 126 goto _err;
143 } 127 }
144 } 128 }
145 xdma1 = dma1[dev]; 129 xdma1 = dma1[dev];
146 if (xdma1 == SNDRV_AUTO_DMA) { 130 if (xdma1 == SNDRV_AUTO_DMA) {
147 if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) { 131 if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
148 snd_card_free(card); 132 snd_printk(KERN_ERR PFX "unable to find a free DMA1\n");
149 snd_printk("unable to find a free DMA1\n"); 133 err = -EBUSY;
150 return -EBUSY; 134 goto _err;
151 } 135 }
152 } 136 }
153 xdma2 = dma2[dev]; 137 xdma2 = dma2[dev];
154 if (xdma2 == SNDRV_AUTO_DMA) { 138 if (xdma2 == SNDRV_AUTO_DMA) {
155 if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) { 139 if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
156 snd_card_free(card); 140 snd_printk(KERN_ERR PFX "unable to find a free DMA2\n");
157 snd_printk("unable to find a free DMA2\n"); 141 err = -EBUSY;
158 return -EBUSY; 142 goto _err;
159 } 143 }
160 } 144 }
161 145
@@ -164,47 +148,48 @@ static int __init snd_gusclassic_probe(int dev)
164 port[dev], 148 port[dev],
165 xirq, xdma1, xdma2, 149 xirq, xdma1, xdma2,
166 0, channels[dev], pcm_channels[dev], 150 0, channels[dev], pcm_channels[dev],
167 0, &gus)) < 0) { 151 0, &gus)) < 0)
168 snd_card_free(card); 152 goto _err;
169 return err; 153
170 } 154 if ((err = snd_gusclassic_detect(gus)) < 0)
171 if ((err = snd_gusclassic_detect(gus)) < 0) { 155 goto _err;
172 snd_card_free(card); 156
173 return err;
174 }
175 snd_gusclassic_init(dev, gus); 157 snd_gusclassic_init(dev, gus);
176 if ((err = snd_gus_initialize(gus)) < 0) { 158 if ((err = snd_gus_initialize(gus)) < 0)
177 snd_card_free(card); 159 goto _err;
178 return err; 160
179 }
180 if (gus->max_flag || gus->ess_flag) { 161 if (gus->max_flag || gus->ess_flag) {
181 snd_printdd("GUS Classic or ACE soundcard was not detected at 0x%lx\n", gus->gf1.port); 162 snd_printk(KERN_ERR PFX "GUS Classic or ACE soundcard was not detected at 0x%lx\n", gus->gf1.port);
182 snd_card_free(card); 163 err = -ENODEV;
183 return -ENODEV; 164 goto _err;
184 }
185 if ((err = snd_gf1_new_mixer(gus)) < 0) {
186 snd_card_free(card);
187 return err;
188 }
189 if ((err = snd_gf1_pcm_new(gus, 0, 0, NULL)) < 0) {
190 snd_card_free(card);
191 return err;
192 } 165 }
166
167 if ((err = snd_gf1_new_mixer(gus)) < 0)
168 goto _err;
169
170 if ((err = snd_gf1_pcm_new(gus, 0, 0, NULL)) < 0)
171 goto _err;
172
193 if (!gus->ace_flag) { 173 if (!gus->ace_flag) {
194 if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0) { 174 if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0)
195 snd_card_free(card); 175 goto _err;
196 return err;
197 }
198 } 176 }
199 sprintf(card->longname + strlen(card->longname), " at 0x%lx, irq %d, dma %d", gus->gf1.port, xirq, xdma1); 177 sprintf(card->longname + strlen(card->longname), " at 0x%lx, irq %d, dma %d", gus->gf1.port, xirq, xdma1);
200 if (dma2 >= 0) 178 if (dma2 >= 0)
201 sprintf(card->longname + strlen(card->longname), "&%d", xdma2); 179 sprintf(card->longname + strlen(card->longname), "&%d", xdma2);
202 if ((err = snd_card_register(card)) < 0) { 180
203 snd_card_free(card); 181 if ((err = snd_card_set_generic_dev(card)) < 0)
204 return err; 182 goto _err;
205 } 183
184 if ((err = snd_card_register(card)) < 0)
185 goto _err;
186
206 snd_gusclassic_cards[dev] = card; 187 snd_gusclassic_cards[dev] = card;
207 return 0; 188 return 0;
189
190 _err:
191 snd_card_free(card);
192 return err;
208} 193}
209 194
210static int __init snd_gusclassic_legacy_auto_probe(unsigned long xport) 195static int __init snd_gusclassic_legacy_auto_probe(unsigned long xport)
diff --git a/sound/isa/gus/gusextreme.c b/sound/isa/gus/gusextreme.c
index bc6fecb18dcf..d2e7cb1df537 100644
--- a/sound/isa/gus/gusextreme.c
+++ b/sound/isa/gus/gusextreme.c
@@ -87,6 +87,7 @@ MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for GUS Extreme driver.");
87 87
88static snd_card_t *snd_gusextreme_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; 88static snd_card_t *snd_gusextreme_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
89 89
90#define PFX "gusextreme: "
90 91
91static int __init snd_gusextreme_detect(int dev, 92static int __init snd_gusextreme_detect(int dev,
92 snd_card_t * card, 93 snd_card_t * card,
@@ -94,6 +95,7 @@ static int __init snd_gusextreme_detect(int dev,
94 es1688_t *es1688) 95 es1688_t *es1688)
95{ 96{
96 unsigned long flags; 97 unsigned long flags;
98 unsigned char d;
97 99
98 /* 100 /*
99 * This is main stuff - enable access to GF1 chip... 101 * This is main stuff - enable access to GF1 chip...
@@ -123,36 +125,17 @@ static int __init snd_gusextreme_detect(int dev,
123 udelay(100); 125 udelay(100);
124 126
125 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0); /* reset GF1 */ 127 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0); /* reset GF1 */
126#ifdef CONFIG_SND_DEBUG_DETECT 128 if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) {
127 { 129 snd_printdd("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d);
128 unsigned char d;
129
130 if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) {
131 snd_printk("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d);
132 return -EIO;
133 }
134 }
135#else
136 if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 0)
137 return -EIO; 130 return -EIO;
138#endif 131 }
139 udelay(160); 132 udelay(160);
140 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1); /* release reset */ 133 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1); /* release reset */
141 udelay(160); 134 udelay(160);
142#ifdef CONFIG_SND_DEBUG_DETECT 135 if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
143 { 136 snd_printdd("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
144 unsigned char d;
145
146 if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
147 snd_printk("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
148 return -EIO;
149 }
150 }
151#else
152 if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 1)
153 return -EIO; 137 return -EIO;
154#endif 138 }
155
156 return 0; 139 return 0;
157} 140}
158 141
@@ -205,7 +188,7 @@ static int __init snd_gusextreme_probe(int dev)
205 xgf1_irq = gf1_irq[dev]; 188 xgf1_irq = gf1_irq[dev];
206 if (xgf1_irq == SNDRV_AUTO_IRQ) { 189 if (xgf1_irq == SNDRV_AUTO_IRQ) {
207 if ((xgf1_irq = snd_legacy_find_free_irq(possible_gf1_irqs)) < 0) { 190 if ((xgf1_irq = snd_legacy_find_free_irq(possible_gf1_irqs)) < 0) {
208 snd_printk("unable to find a free IRQ for GF1\n"); 191 snd_printk(KERN_ERR PFX "unable to find a free IRQ for GF1\n");
209 err = -EBUSY; 192 err = -EBUSY;
210 goto out; 193 goto out;
211 } 194 }
@@ -213,7 +196,7 @@ static int __init snd_gusextreme_probe(int dev)
213 xess_irq = irq[dev]; 196 xess_irq = irq[dev];
214 if (xess_irq == SNDRV_AUTO_IRQ) { 197 if (xess_irq == SNDRV_AUTO_IRQ) {
215 if ((xess_irq = snd_legacy_find_free_irq(possible_ess_irqs)) < 0) { 198 if ((xess_irq = snd_legacy_find_free_irq(possible_ess_irqs)) < 0) {
216 snd_printk("unable to find a free IRQ for ES1688\n"); 199 snd_printk(KERN_ERR PFX "unable to find a free IRQ for ES1688\n");
217 err = -EBUSY; 200 err = -EBUSY;
218 goto out; 201 goto out;
219 } 202 }
@@ -226,7 +209,7 @@ static int __init snd_gusextreme_probe(int dev)
226 xgf1_dma = dma1[dev]; 209 xgf1_dma = dma1[dev];
227 if (xgf1_dma == SNDRV_AUTO_DMA) { 210 if (xgf1_dma == SNDRV_AUTO_DMA) {
228 if ((xgf1_dma = snd_legacy_find_free_dma(possible_gf1_dmas)) < 0) { 211 if ((xgf1_dma = snd_legacy_find_free_dma(possible_gf1_dmas)) < 0) {
229 snd_printk("unable to find a free DMA for GF1\n"); 212 snd_printk(KERN_ERR PFX "unable to find a free DMA for GF1\n");
230 err = -EBUSY; 213 err = -EBUSY;
231 goto out; 214 goto out;
232 } 215 }
@@ -234,7 +217,7 @@ static int __init snd_gusextreme_probe(int dev)
234 xess_dma = dma8[dev]; 217 xess_dma = dma8[dev];
235 if (xess_dma == SNDRV_AUTO_DMA) { 218 if (xess_dma == SNDRV_AUTO_DMA) {
236 if ((xess_dma = snd_legacy_find_free_dma(possible_ess_dmas)) < 0) { 219 if ((xess_dma = snd_legacy_find_free_dma(possible_ess_dmas)) < 0) {
237 snd_printk("unable to find a free DMA for ES1688\n"); 220 snd_printk(KERN_ERR PFX "unable to find a free DMA for ES1688\n");
238 err = -EBUSY; 221 err = -EBUSY;
239 goto out; 222 goto out;
240 } 223 }
@@ -264,7 +247,7 @@ static int __init snd_gusextreme_probe(int dev)
264 goto out; 247 goto out;
265 248
266 if (!gus->ess_flag) { 249 if (!gus->ess_flag) {
267 snd_printdd("GUS Extreme soundcard was not detected at 0x%lx\n", gus->gf1.port); 250 snd_printk(KERN_ERR PFX "GUS Extreme soundcard was not detected at 0x%lx\n", gus->gf1.port);
268 err = -ENODEV; 251 err = -ENODEV;
269 goto out; 252 goto out;
270 } 253 }
@@ -287,7 +270,7 @@ static int __init snd_gusextreme_probe(int dev)
287 270
288 if (snd_opl3_create(card, es1688->port, es1688->port + 2, 271 if (snd_opl3_create(card, es1688->port, es1688->port + 2,
289 OPL3_HW_OPL3, 0, &opl3) < 0) { 272 OPL3_HW_OPL3, 0, &opl3) < 0) {
290 printk(KERN_ERR "gusextreme: opl3 not detected at 0x%lx\n", es1688->port); 273 printk(KERN_ERR PFX "gusextreme: opl3 not detected at 0x%lx\n", es1688->port);
291 } else { 274 } else {
292 if ((err = snd_opl3_hwdep_new(opl3, 0, 2, NULL)) < 0) 275 if ((err = snd_opl3_hwdep_new(opl3, 0, 2, NULL)) < 0)
293 goto out; 276 goto out;
@@ -303,6 +286,10 @@ static int __init snd_gusextreme_probe(int dev)
303 286
304 sprintf(card->longname, "Gravis UltraSound Extreme at 0x%lx, irq %i&%i, dma %i&%i", 287 sprintf(card->longname, "Gravis UltraSound Extreme at 0x%lx, irq %i&%i, dma %i&%i",
305 es1688->port, xgf1_irq, xess_irq, xgf1_dma, xess_dma); 288 es1688->port, xgf1_irq, xess_irq, xgf1_dma, xess_dma);
289
290 if ((err = snd_card_set_generic_dev(card)) < 0)
291 goto out;
292
306 if ((err = snd_card_register(card)) < 0) 293 if ((err = snd_card_register(card)) < 0)
307 goto out; 294 goto out;
308 295
diff --git a/sound/isa/gus/gusmax.c b/sound/isa/gus/gusmax.c
index 400ff34710fb..0bb44b519340 100644
--- a/sound/isa/gus/gusmax.c
+++ b/sound/isa/gus/gusmax.c
@@ -82,39 +82,25 @@ struct snd_gusmax {
82 82
83static snd_card_t *snd_gusmax_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; 83static snd_card_t *snd_gusmax_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
84 84
85#define PFX "gusmax: "
85 86
86static int __init snd_gusmax_detect(snd_gus_card_t * gus) 87static int __init snd_gusmax_detect(snd_gus_card_t * gus)
87{ 88{
88 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0); /* reset GF1 */ 89 unsigned char d;
89#ifdef CONFIG_SND_DEBUG_DETECT
90 {
91 unsigned char d;
92 90
93 if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) { 91 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0); /* reset GF1 */
94 snd_printk("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d); 92 if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) {
95 return -ENODEV; 93 snd_printdd("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d);
96 }
97 }
98#else
99 if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 0)
100 return -ENODEV; 94 return -ENODEV;
101#endif 95 }
102 udelay(160); 96 udelay(160);
103 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1); /* release reset */ 97 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1); /* release reset */
104 udelay(160); 98 udelay(160);
105#ifdef CONFIG_SND_DEBUG_DETECT 99 if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
106 { 100 snd_printdd("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
107 unsigned char d;
108
109 if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
110 snd_printk("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
111 return -ENODEV;
112 }
113 }
114#else
115 if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 1)
116 return -ENODEV; 101 return -ENODEV;
117#endif 102 }
103
118 return 0; 104 return 0;
119} 105}
120 106
@@ -239,25 +225,25 @@ static int __init snd_gusmax_probe(int dev)
239 xirq = irq[dev]; 225 xirq = irq[dev];
240 if (xirq == SNDRV_AUTO_IRQ) { 226 if (xirq == SNDRV_AUTO_IRQ) {
241 if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { 227 if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) {
242 snd_card_free(card); 228 snd_printk(KERN_ERR PFX "unable to find a free IRQ\n");
243 snd_printk("unable to find a free IRQ\n"); 229 err = -EBUSY;
244 return -EBUSY; 230 goto _err;
245 } 231 }
246 } 232 }
247 xdma1 = dma1[dev]; 233 xdma1 = dma1[dev];
248 if (xdma1 == SNDRV_AUTO_DMA) { 234 if (xdma1 == SNDRV_AUTO_DMA) {
249 if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) { 235 if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
250 snd_card_free(card); 236 snd_printk(KERN_ERR PFX "unable to find a free DMA1\n");
251 snd_printk("unable to find a free DMA1\n"); 237 err = -EBUSY;
252 return -EBUSY; 238 goto _err;
253 } 239 }
254 } 240 }
255 xdma2 = dma2[dev]; 241 xdma2 = dma2[dev];
256 if (xdma2 == SNDRV_AUTO_DMA) { 242 if (xdma2 == SNDRV_AUTO_DMA) {
257 if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) { 243 if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
258 snd_card_free(card); 244 snd_printk(KERN_ERR PFX "unable to find a free DMA2\n");
259 snd_printk("unable to find a free DMA2\n"); 245 err = -EBUSY;
260 return -EBUSY; 246 goto _err;
261 } 247 }
262 } 248 }
263 249
@@ -266,31 +252,28 @@ static int __init snd_gusmax_probe(int dev)
266 -xirq, xdma1, xdma2, 252 -xirq, xdma1, xdma2,
267 0, channels[dev], 253 0, channels[dev],
268 pcm_channels[dev], 254 pcm_channels[dev],
269 0, &gus)) < 0) { 255 0, &gus)) < 0)
270 snd_card_free(card); 256 goto _err;
271 return err; 257
272 } 258 if ((err = snd_gusmax_detect(gus)) < 0)
273 if ((err = snd_gusmax_detect(gus)) < 0) { 259 goto _err;
274 snd_card_free(card); 260
275 return err;
276 }
277 maxcard->gus_status_reg = gus->gf1.reg_irqstat; 261 maxcard->gus_status_reg = gus->gf1.reg_irqstat;
278 maxcard->pcm_status_reg = gus->gf1.port + 0x10c + 2; 262 maxcard->pcm_status_reg = gus->gf1.port + 0x10c + 2;
279 snd_gusmax_init(dev, card, gus); 263 snd_gusmax_init(dev, card, gus);
280 if ((err = snd_gus_initialize(gus)) < 0) { 264 if ((err = snd_gus_initialize(gus)) < 0)
281 snd_card_free(card); 265 goto _err;
282 return err; 266
283 }
284 if (!gus->max_flag) { 267 if (!gus->max_flag) {
285 printk(KERN_ERR "GUS MAX soundcard was not detected at 0x%lx\n", gus->gf1.port); 268 snd_printk(KERN_ERR PFX "GUS MAX soundcard was not detected at 0x%lx\n", gus->gf1.port);
286 snd_card_free(card); 269 err = -ENODEV;
287 return -ENODEV; 270 goto _err;
288 } 271 }
289 272
290 if (request_irq(xirq, snd_gusmax_interrupt, SA_INTERRUPT, "GUS MAX", (void *)maxcard)) { 273 if (request_irq(xirq, snd_gusmax_interrupt, SA_INTERRUPT, "GUS MAX", (void *)maxcard)) {
291 snd_card_free(card); 274 snd_printk(KERN_ERR PFX "unable to grab IRQ %d\n", xirq);
292 printk(KERN_ERR "gusmax: unable to grab IRQ %d\n", xirq); 275 err = -EBUSY;
293 return -EBUSY; 276 goto _err;
294 } 277 }
295 maxcard->irq = xirq; 278 maxcard->irq = xirq;
296 279
@@ -301,50 +284,46 @@ static int __init snd_gusmax_probe(int dev)
301 CS4231_HWSHARE_IRQ | 284 CS4231_HWSHARE_IRQ |
302 CS4231_HWSHARE_DMA1 | 285 CS4231_HWSHARE_DMA1 |
303 CS4231_HWSHARE_DMA2, 286 CS4231_HWSHARE_DMA2,
304 &cs4231)) < 0) { 287 &cs4231)) < 0)
305 snd_card_free(card); 288 goto _err;
306 return err; 289
307 } 290 if ((err = snd_cs4231_pcm(cs4231, 0, NULL)) < 0)
308 if ((err = snd_cs4231_pcm(cs4231, 0, NULL)) < 0) { 291 goto _err;
309 snd_card_free(card); 292
310 return err; 293 if ((err = snd_cs4231_mixer(cs4231)) < 0)
311 } 294 goto _err;
312 if ((err = snd_cs4231_mixer(cs4231)) < 0) { 295
313 snd_card_free(card); 296 if ((err = snd_cs4231_timer(cs4231, 2, NULL)) < 0)
314 return err; 297 goto _err;
315 } 298
316 if ((err = snd_cs4231_timer(cs4231, 2, NULL)) < 0) {
317 snd_card_free(card);
318 return err;
319 }
320 if (pcm_channels[dev] > 0) { 299 if (pcm_channels[dev] > 0) {
321 if ((err = snd_gf1_pcm_new(gus, 1, 1, NULL)) < 0) { 300 if ((err = snd_gf1_pcm_new(gus, 1, 1, NULL)) < 0)
322 snd_card_free(card); 301 goto _err;
323 return err;
324 }
325 }
326 if ((err = snd_gusmax_mixer(cs4231)) < 0) {
327 snd_card_free(card);
328 return err;
329 } 302 }
303 if ((err = snd_gusmax_mixer(cs4231)) < 0)
304 goto _err;
330 305
331 if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0) { 306 if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0)
332 snd_card_free(card); 307 goto _err;
333 return err;
334 }
335 308
336 sprintf(card->longname + strlen(card->longname), " at 0x%lx, irq %i, dma %i", gus->gf1.port, xirq, xdma1); 309 sprintf(card->longname + strlen(card->longname), " at 0x%lx, irq %i, dma %i", gus->gf1.port, xirq, xdma1);
337 if (xdma2 >= 0) 310 if (xdma2 >= 0)
338 sprintf(card->longname + strlen(card->longname), "&%i", xdma2); 311 sprintf(card->longname + strlen(card->longname), "&%i", xdma2);
339 if ((err = snd_card_register(card)) < 0) { 312
340 snd_card_free(card); 313 if ((err = snd_card_set_generic_dev(card)) < 0)
341 return err; 314 goto _err;
342 } 315
316 if ((err = snd_card_register(card)) < 0)
317 goto _err;
343 318
344 maxcard->gus = gus; 319 maxcard->gus = gus;
345 maxcard->cs4231 = cs4231; 320 maxcard->cs4231 = cs4231;
346 snd_gusmax_cards[dev] = card; 321 snd_gusmax_cards[dev] = card;
347 return 0; 322 return 0;
323
324 _err:
325 snd_card_free(card);
326 return err;
348} 327}
349 328
350static int __init snd_gusmax_legacy_auto_probe(unsigned long xport) 329static int __init snd_gusmax_legacy_auto_probe(unsigned long xport)
diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c
index 46e867daba6a..358cba9d738f 100644
--- a/sound/isa/gus/interwave.c
+++ b/sound/isa/gus/interwave.c
@@ -73,6 +73,12 @@ static int midi[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
73static int pcm_channels[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2}; 73static int pcm_channels[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2};
74static int effect[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; 74static int effect[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
75 75
76#ifdef SNDRV_STB
77#define PFX "interwave-stb: "
78#else
79#define PFX "interwave: "
80#endif
81
76module_param_array(index, int, NULL, 0444); 82module_param_array(index, int, NULL, 0444);
77MODULE_PARM_DESC(index, "Index value for InterWave soundcard."); 83MODULE_PARM_DESC(index, "Index value for InterWave soundcard.");
78module_param_array(id, charp, NULL, 0444); 84module_param_array(id, charp, NULL, 0444);
@@ -249,38 +255,20 @@ static int __devinit snd_interwave_detect(struct snd_interwave *iwcard,
249{ 255{
250 unsigned long flags; 256 unsigned long flags;
251 unsigned char rev1, rev2; 257 unsigned char rev1, rev2;
258 int d;
252 259
253 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0); /* reset GF1 */ 260 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0); /* reset GF1 */
254#ifdef CONFIG_SND_DEBUG_DETECT 261 if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) {
255 { 262 snd_printdd("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d);
256 int d;
257
258 if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) {
259 snd_printk("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d);
260 return -ENODEV;
261 }
262 }
263#else
264 if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 0)
265 return -ENODEV; 263 return -ENODEV;
266#endif 264 }
267 udelay(160); 265 udelay(160);
268 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1); /* release reset */ 266 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1); /* release reset */
269 udelay(160); 267 udelay(160);
270#ifdef CONFIG_SND_DEBUG_DETECT 268 if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
271 { 269 snd_printdd("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
272 int d;
273
274 if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
275 snd_printk("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
276 return -ENODEV;
277 }
278 }
279#else
280 if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 1)
281 return -ENODEV; 270 return -ENODEV;
282#endif 271 }
283
284 spin_lock_irqsave(&gus->reg_lock, flags); 272 spin_lock_irqsave(&gus->reg_lock, flags);
285 rev1 = snd_gf1_look8(gus, SNDRV_GF1_GB_VERSION_NUMBER); 273 rev1 = snd_gf1_look8(gus, SNDRV_GF1_GB_VERSION_NUMBER);
286 snd_gf1_write8(gus, SNDRV_GF1_GB_VERSION_NUMBER, ~rev1); 274 snd_gf1_write8(gus, SNDRV_GF1_GB_VERSION_NUMBER, ~rev1);
@@ -686,35 +674,33 @@ static int __devinit snd_interwave_probe(int dev, struct pnp_card_link *pcard,
686 card->private_free = snd_interwave_free; 674 card->private_free = snd_interwave_free;
687#ifdef CONFIG_PNP 675#ifdef CONFIG_PNP
688 if (isapnp[dev]) { 676 if (isapnp[dev]) {
689 if (snd_interwave_pnp(dev, iwcard, pcard, pid)) { 677 if ((err = snd_interwave_pnp(dev, iwcard, pcard, pid)) < 0)
690 snd_card_free(card); 678 goto _err;
691 return -ENODEV;
692 }
693 snd_card_set_dev(card, &pcard->card->dev); 679 snd_card_set_dev(card, &pcard->card->dev);
694 } 680 }
695#endif 681#endif
696 xirq = irq[dev]; 682 xirq = irq[dev];
697 if (xirq == SNDRV_AUTO_IRQ) { 683 if (xirq == SNDRV_AUTO_IRQ) {
698 if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { 684 if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) {
699 snd_card_free(card); 685 snd_printk(KERN_ERR PFX "unable to find a free IRQ\n");
700 snd_printk("unable to find a free IRQ\n"); 686 err = -EBUSY;
701 return -EBUSY; 687 goto _err;
702 } 688 }
703 } 689 }
704 xdma1 = dma1[dev]; 690 xdma1 = dma1[dev];
705 if (xdma1 == SNDRV_AUTO_DMA) { 691 if (xdma1 == SNDRV_AUTO_DMA) {
706 if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) { 692 if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
707 snd_card_free(card); 693 snd_printk(KERN_ERR PFX "unable to find a free DMA1\n");
708 snd_printk("unable to find a free DMA1\n"); 694 err = -EBUSY;
709 return -EBUSY; 695 goto _err;
710 } 696 }
711 } 697 }
712 xdma2 = dma2[dev]; 698 xdma2 = dma2[dev];
713 if (xdma2 == SNDRV_AUTO_DMA) { 699 if (xdma2 == SNDRV_AUTO_DMA) {
714 if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) { 700 if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
715 snd_card_free(card); 701 snd_printk(KERN_ERR PFX "unable to find a free DMA2\n");
716 snd_printk("unable to find a free DMA2\n"); 702 err = -EBUSY;
717 return -EBUSY; 703 goto _err;
718 } 704 }
719 } 705 }
720 706
@@ -722,32 +708,28 @@ static int __devinit snd_interwave_probe(int dev, struct pnp_card_link *pcard,
722 port[dev], 708 port[dev],
723 -xirq, xdma1, xdma2, 709 -xirq, xdma1, xdma2,
724 0, 32, 710 0, 32,
725 pcm_channels[dev], effect[dev], &gus)) < 0) { 711 pcm_channels[dev], effect[dev], &gus)) < 0)
726 snd_card_free(card); 712 goto _err;
727 return err; 713
728 }
729 if ((err = snd_interwave_detect(iwcard, gus, dev 714 if ((err = snd_interwave_detect(iwcard, gus, dev
730#ifdef SNDRV_STB 715#ifdef SNDRV_STB
731 , &i2c_bus 716 , &i2c_bus
732#endif 717#endif
733 )) < 0) { 718 )) < 0)
734 snd_card_free(card); 719 goto _err;
735 return err; 720
736 }
737 iwcard->gus_status_reg = gus->gf1.reg_irqstat; 721 iwcard->gus_status_reg = gus->gf1.reg_irqstat;
738 iwcard->pcm_status_reg = gus->gf1.port + 0x10c + 2; 722 iwcard->pcm_status_reg = gus->gf1.port + 0x10c + 2;
739 723
740 snd_interwave_init(dev, gus); 724 snd_interwave_init(dev, gus);
741 snd_interwave_detect_memory(gus); 725 snd_interwave_detect_memory(gus);
742 if ((err = snd_gus_initialize(gus)) < 0) { 726 if ((err = snd_gus_initialize(gus)) < 0)
743 snd_card_free(card); 727 goto _err;
744 return err;
745 }
746 728
747 if (request_irq(xirq, snd_interwave_interrupt, SA_INTERRUPT, "InterWave", (void *)iwcard)) { 729 if (request_irq(xirq, snd_interwave_interrupt, SA_INTERRUPT, "InterWave", (void *)iwcard)) {
748 snd_card_free(card); 730 snd_printk(KERN_ERR PFX "unable to grab IRQ %d\n", xirq);
749 snd_printk("unable to grab IRQ %d\n", xirq); 731 err = -EBUSY;
750 return -EBUSY; 732 goto _err;
751 } 733 }
752 iwcard->irq = xirq; 734 iwcard->irq = xirq;
753 735
@@ -758,34 +740,28 @@ static int __devinit snd_interwave_probe(int dev, struct pnp_card_link *pcard,
758 CS4231_HWSHARE_IRQ | 740 CS4231_HWSHARE_IRQ |
759 CS4231_HWSHARE_DMA1 | 741 CS4231_HWSHARE_DMA1 |
760 CS4231_HWSHARE_DMA2, 742 CS4231_HWSHARE_DMA2,
761 &cs4231)) < 0) { 743 &cs4231)) < 0)
762 snd_card_free(card); 744 goto _err;
763 return err; 745
764 } 746 if ((err = snd_cs4231_pcm(cs4231, 0, &pcm)) < 0)
765 if ((err = snd_cs4231_pcm(cs4231, 0, &pcm)) < 0) { 747 goto _err;
766 snd_card_free(card); 748
767 return err;
768 }
769 sprintf(pcm->name + strlen(pcm->name), " rev %c", gus->revision + 'A'); 749 sprintf(pcm->name + strlen(pcm->name), " rev %c", gus->revision + 'A');
770 strcat(pcm->name, " (codec)"); 750 strcat(pcm->name, " (codec)");
771 if ((err = snd_cs4231_timer(cs4231, 2, NULL)) < 0) { 751
772 snd_card_free(card); 752 if ((err = snd_cs4231_timer(cs4231, 2, NULL)) < 0)
773 return err; 753 goto _err;
774 } 754
775 if ((err = snd_cs4231_mixer(cs4231)) < 0) { 755 if ((err = snd_cs4231_mixer(cs4231)) < 0)
776 snd_card_free(card); 756 goto _err;
777 return err; 757
778 }
779 if (pcm_channels[dev] > 0) { 758 if (pcm_channels[dev] > 0) {
780 if ((err = snd_gf1_pcm_new(gus, 1, 1, NULL)) < 0) { 759 if ((err = snd_gf1_pcm_new(gus, 1, 1, NULL)) < 0)
781 snd_card_free(card); 760 goto _err;
782 return err;
783 }
784 }
785 if ((err = snd_interwave_mixer(cs4231)) < 0) {
786 snd_card_free(card);
787 return err;
788 } 761 }
762 if ((err = snd_interwave_mixer(cs4231)) < 0)
763 goto _err;
764
789#ifdef SNDRV_STB 765#ifdef SNDRV_STB
790 { 766 {
791 snd_ctl_elem_id_t id1, id2; 767 snd_ctl_elem_id_t id1, id2;
@@ -795,28 +771,20 @@ static int __devinit snd_interwave_probe(int dev, struct pnp_card_link *pcard,
795 strcpy(id1.name, "Master Playback Switch"); 771 strcpy(id1.name, "Master Playback Switch");
796 strcpy(id2.name, id1.name); 772 strcpy(id2.name, id1.name);
797 id2.index = 1; 773 id2.index = 1;
798 if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0) { 774 if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0)
799 snd_card_free(card); 775 goto _err;
800 return err;
801 }
802 strcpy(id1.name, "Master Playback Volume"); 776 strcpy(id1.name, "Master Playback Volume");
803 strcpy(id2.name, id1.name); 777 strcpy(id2.name, id1.name);
804 if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0) { 778 if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0)
805 snd_card_free(card); 779 goto _err;
806 return err; 780 if ((err = snd_tea6330t_update_mixer(card, i2c_bus, 0, 1)) < 0)
807 } 781 goto _err;
808 if ((err = snd_tea6330t_update_mixer(card, i2c_bus, 0, 1)) < 0) {
809 snd_card_free(card);
810 return err;
811 }
812 } 782 }
813#endif 783#endif
814 784
815 gus->uart_enable = midi[dev]; 785 gus->uart_enable = midi[dev];
816 if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0) { 786 if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0)
817 snd_card_free(card); 787 goto _err;
818 return err;
819 }
820 788
821#ifndef SNDRV_STB 789#ifndef SNDRV_STB
822 str = "AMD InterWave"; 790 str = "AMD InterWave";
@@ -835,10 +803,11 @@ static int __devinit snd_interwave_probe(int dev, struct pnp_card_link *pcard,
835 if (xdma2 >= 0) 803 if (xdma2 >= 0)
836 sprintf(card->longname + strlen(card->longname), "&%d", xdma2); 804 sprintf(card->longname + strlen(card->longname), "&%d", xdma2);
837 805
838 if ((err = snd_card_register(card)) < 0) { 806 if ((err = snd_card_set_generic_dev(card)) < 0)
839 snd_card_free(card); 807 goto _err;
840 return err; 808
841 } 809 if ((err = snd_card_register(card)) < 0)
810 goto _err;
842 811
843 iwcard->cs4231 = cs4231; 812 iwcard->cs4231 = cs4231;
844 iwcard->gus = gus; 813 iwcard->gus = gus;
@@ -847,6 +816,10 @@ static int __devinit snd_interwave_probe(int dev, struct pnp_card_link *pcard,
847 else 816 else
848 snd_interwave_legacy[dev++] = card; 817 snd_interwave_legacy[dev++] = card;
849 return 0; 818 return 0;
819
820 _err:
821 snd_card_free(card);
822 return err;
850} 823}
851 824
852static int __devinit snd_interwave_probe_legacy_port(unsigned long xport) 825static int __devinit snd_interwave_probe_legacy_port(unsigned long xport)
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c
index 75bd6eca63e7..e2d615bbb2f7 100644
--- a/sound/isa/opl3sa2.c
+++ b/sound/isa/opl3sa2.c
@@ -143,6 +143,8 @@ struct snd_opl3sa2 {
143 143
144static snd_card_t *snd_opl3sa2_legacy[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; 144static snd_card_t *snd_opl3sa2_legacy[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
145 145
146#define PFX "opl3sa2: "
147
146#ifdef CONFIG_PNP 148#ifdef CONFIG_PNP
147 149
148static struct pnp_device_id snd_opl3sa2_pnpbiosids[] = { 150static struct pnp_device_id snd_opl3sa2_pnpbiosids[] = {
@@ -231,7 +233,7 @@ static int __init snd_opl3sa2_detect(opl3sa2_t *chip)
231 card = chip->card; 233 card = chip->card;
232 port = chip->port; 234 port = chip->port;
233 if ((chip->res_port = request_region(port, 2, "OPL3-SA control")) == NULL) { 235 if ((chip->res_port = request_region(port, 2, "OPL3-SA control")) == NULL) {
234 snd_printk(KERN_ERR "opl3sa2: can't grab port 0x%lx\n", port); 236 snd_printk(KERN_ERR PFX "can't grab port 0x%lx\n", port);
235 return -EBUSY; 237 return -EBUSY;
236 } 238 }
237 // snd_printk("REG 0A = 0x%x\n", snd_opl3sa2_read(chip, 0x0a)); 239 // snd_printk("REG 0A = 0x%x\n", snd_opl3sa2_read(chip, 0x0a));
@@ -668,6 +670,12 @@ static int snd_opl3sa2_dev_free(snd_device_t *device)
668 return snd_opl3sa2_free(chip); 670 return snd_opl3sa2_free(chip);
669} 671}
670 672
673#ifdef CONFIG_PNP
674#define is_isapnp_selected(dev) isapnp[dev]
675#else
676#define is_isapnp_selected(dev) 0
677#endif
678
671static int __devinit snd_opl3sa2_probe(int dev, 679static int __devinit snd_opl3sa2_probe(int dev,
672 struct pnp_dev *pdev, 680 struct pnp_dev *pdev,
673 struct pnp_card_link *pcard, 681 struct pnp_card_link *pcard,
@@ -683,28 +691,25 @@ static int __devinit snd_opl3sa2_probe(int dev,
683 }; 691 };
684 int err; 692 int err;
685 693
686#ifdef CONFIG_PNP 694 if (! is_isapnp_selected(dev)) {
687 if (!isapnp[dev]) {
688#endif
689 if (port[dev] == SNDRV_AUTO_PORT) { 695 if (port[dev] == SNDRV_AUTO_PORT) {
690 snd_printk("specify port\n"); 696 snd_printk(KERN_ERR PFX "specify port\n");
691 return -EINVAL; 697 return -EINVAL;
692 } 698 }
693 if (wss_port[dev] == SNDRV_AUTO_PORT) { 699 if (wss_port[dev] == SNDRV_AUTO_PORT) {
694 snd_printk("specify wss_port\n"); 700 snd_printk(KERN_ERR PFX "specify wss_port\n");
695 return -EINVAL; 701 return -EINVAL;
696 } 702 }
697 if (fm_port[dev] == SNDRV_AUTO_PORT) { 703 if (fm_port[dev] == SNDRV_AUTO_PORT) {
698 snd_printk("specify fm_port\n"); 704 snd_printk(KERN_ERR PFX "specify fm_port\n");
699 return -EINVAL; 705 return -EINVAL;
700 } 706 }
701 if (midi_port[dev] == SNDRV_AUTO_PORT) { 707 if (midi_port[dev] == SNDRV_AUTO_PORT) {
702 snd_printk("specify midi_port\n"); 708 snd_printk(KERN_ERR PFX "specify midi_port\n");
703 return -EINVAL; 709 return -EINVAL;
704 } 710 }
705#ifdef CONFIG_PNP
706 } 711 }
707#endif 712
708 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 713 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
709 if (card == NULL) 714 if (card == NULL)
710 return -ENOMEM; 715 return -ENOMEM;
@@ -742,7 +747,7 @@ static int __devinit snd_opl3sa2_probe(int dev,
742 if ((err = snd_opl3sa2_detect(chip)) < 0) 747 if ((err = snd_opl3sa2_detect(chip)) < 0)
743 goto __error; 748 goto __error;
744 if (request_irq(xirq, snd_opl3sa2_interrupt, SA_INTERRUPT, "OPL3-SA2", (void *)chip)) { 749 if (request_irq(xirq, snd_opl3sa2_interrupt, SA_INTERRUPT, "OPL3-SA2", (void *)chip)) {
745 snd_printk(KERN_ERR "opl3sa2: can't grab IRQ %d\n", xirq); 750 snd_printk(KERN_ERR PFX "can't grab IRQ %d\n", xirq);
746 err = -ENODEV; 751 err = -ENODEV;
747 goto __error; 752 goto __error;
748 } 753 }
@@ -795,6 +800,9 @@ static int __devinit snd_opl3sa2_probe(int dev,
795 if (dma2 >= 0) 800 if (dma2 >= 0)
796 sprintf(card->longname + strlen(card->longname), "&%d", xdma2); 801 sprintf(card->longname + strlen(card->longname), "&%d", xdma2);
797 802
803 if ((err = snd_card_set_generic_dev(card)) < 0)
804 goto __error;
805
798 if ((err = snd_card_register(card)) < 0) 806 if ((err = snd_card_register(card)) < 0)
799 goto __error; 807 goto __error;
800 808
@@ -852,8 +860,10 @@ static int __devinit snd_opl3sa2_pnp_cdetect(struct pnp_card_link *card,
852 int res; 860 int res;
853 861
854 for ( ; dev < SNDRV_CARDS; dev++) { 862 for ( ; dev < SNDRV_CARDS; dev++) {
855 if (!enable[dev] || !isapnp[dev]) 863 if (!enable[dev])
856 continue; 864 continue;
865 if (is_isapnp_selected(dev))
866 continue;
857 res = snd_opl3sa2_probe(dev, NULL, card, id); 867 res = snd_opl3sa2_probe(dev, NULL, card, id);
858 if (res < 0) 868 if (res < 0)
859 return res; 869 return res;
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c
index 782750d62ebb..a490bcacdfa8 100644
--- a/sound/isa/opti9xx/opti92x-ad1848.c
+++ b/sound/isa/opti9xx/opti92x-ad1848.c
@@ -1894,8 +1894,8 @@ static void snd_card_opti9xx_free(snd_card_t *card)
1894 } 1894 }
1895} 1895}
1896 1896
1897static int __devinit snd_card_opti9xx_probe(struct pnp_card_link *pcard, 1897static int snd_card_opti9xx_probe(struct pnp_card_link *pcard,
1898 const struct pnp_card_device_id *pid) 1898 const struct pnp_card_device_id *pid)
1899{ 1899{
1900 static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; 1900 static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1};
1901 static long possible_mpu_ports[] = {0x300, 0x310, 0x320, 0x330, -1}; 1901 static long possible_mpu_ports[] = {0x300, 0x310, 0x320, 0x330, -1};
@@ -1965,6 +1965,10 @@ static int __devinit snd_card_opti9xx_probe(struct pnp_card_link *pcard,
1965 snd_card_free(card); 1965 snd_card_free(card);
1966 return error; 1966 return error;
1967 } 1967 }
1968 if ((error = snd_card_set_generic_dev(card)) < 0) {
1969 snd_card_free(card);
1970 return error;
1971 }
1968#ifdef CONFIG_PNP 1972#ifdef CONFIG_PNP
1969 } 1973 }
1970#endif /* CONFIG_PNP */ 1974#endif /* CONFIG_PNP */
diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c
index 60e2c53c49fc..7888783d68f5 100644
--- a/sound/isa/sb/sb16.c
+++ b/sound/isa/sb/sb16.c
@@ -351,6 +351,12 @@ static void snd_sb16_free(snd_card_t *card)
351 } 351 }
352} 352}
353 353
354#ifdef CONFIG_PNP
355#define is_isapnp_selected(dev) isapnp[dev]
356#else
357#define is_isapnp_selected(dev) 0
358#endif
359
354static int __init snd_sb16_probe(int dev, 360static int __init snd_sb16_probe(int dev,
355 struct pnp_card_link *pcard, 361 struct pnp_card_link *pcard,
356 const struct pnp_card_device_id *pid) 362 const struct pnp_card_device_id *pid)
@@ -378,10 +384,8 @@ static int __init snd_sb16_probe(int dev,
378 card->private_free = snd_sb16_free; 384 card->private_free = snd_sb16_free;
379#ifdef CONFIG_PNP 385#ifdef CONFIG_PNP
380 if (isapnp[dev]) { 386 if (isapnp[dev]) {
381 if ((err = snd_card_sb16_pnp(dev, acard, pcard, pid))) { 387 if ((err = snd_card_sb16_pnp(dev, acard, pcard, pid)))
382 snd_card_free(card); 388 goto _err;
383 return err;
384 }
385 snd_card_set_dev(card, &pcard->card->dev); 389 snd_card_set_dev(card, &pcard->card->dev);
386 } 390 }
387#endif 391#endif
@@ -389,41 +393,37 @@ static int __init snd_sb16_probe(int dev,
389 xirq = irq[dev]; 393 xirq = irq[dev];
390 xdma8 = dma8[dev]; 394 xdma8 = dma8[dev];
391 xdma16 = dma16[dev]; 395 xdma16 = dma16[dev];
392#ifdef CONFIG_PNP 396 if (! is_isapnp_selected(dev)) {
393 if (!isapnp[dev]) { 397 if (xirq == SNDRV_AUTO_IRQ) {
394#endif 398 if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) {
395 if (xirq == SNDRV_AUTO_IRQ) { 399 snd_printk(KERN_ERR PFX "unable to find a free IRQ\n");
396 if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { 400 err = -EBUSY;
397 snd_card_free(card); 401 goto _err;
398 snd_printk(KERN_ERR PFX "unable to find a free IRQ\n"); 402 }
399 return -EBUSY;
400 } 403 }
401 } 404 if (xdma8 == SNDRV_AUTO_DMA) {
402 if (xdma8 == SNDRV_AUTO_DMA) { 405 if ((xdma8 = snd_legacy_find_free_dma(possible_dmas8)) < 0) {
403 if ((xdma8 = snd_legacy_find_free_dma(possible_dmas8)) < 0) { 406 snd_printk(KERN_ERR PFX "unable to find a free 8-bit DMA\n");
404 snd_card_free(card); 407 err = -EBUSY;
405 snd_printk(KERN_ERR PFX "unable to find a free 8-bit DMA\n"); 408 goto _err;
406 return -EBUSY; 409 }
407 } 410 }
408 } 411 if (xdma16 == SNDRV_AUTO_DMA) {
409 if (xdma16 == SNDRV_AUTO_DMA) { 412 if ((xdma16 = snd_legacy_find_free_dma(possible_dmas16)) < 0) {
410 if ((xdma16 = snd_legacy_find_free_dma(possible_dmas16)) < 0) { 413 snd_printk(KERN_ERR PFX "unable to find a free 16-bit DMA\n");
411 snd_card_free(card); 414 err = -EBUSY;
412 snd_printk(KERN_ERR PFX "unable to find a free 16-bit DMA\n"); 415 goto _err;
413 return -EBUSY; 416 }
414 } 417 }
415 } 418 /* non-PnP FM port address is hardwired with base port address */
416 /* non-PnP FM port address is hardwired with base port address */ 419 fm_port[dev] = port[dev];
417 fm_port[dev] = port[dev]; 420 /* block the 0x388 port to avoid PnP conflicts */
418 /* block the 0x388 port to avoid PnP conflicts */ 421 acard->fm_res = request_region(0x388, 4, "SoundBlaster FM");
419 acard->fm_res = request_region(0x388, 4, "SoundBlaster FM");
420#ifdef SNDRV_SBAWE_EMU8000 422#ifdef SNDRV_SBAWE_EMU8000
421 /* non-PnP AWE port address is hardwired with base port address */ 423 /* non-PnP AWE port address is hardwired with base port address */
422 awe_port[dev] = port[dev] + 0x400; 424 awe_port[dev] = port[dev] + 0x400;
423#endif 425#endif
424#ifdef CONFIG_PNP
425 } 426 }
426#endif
427 427
428 if ((err = snd_sbdsp_create(card, 428 if ((err = snd_sbdsp_create(card,
429 port[dev], 429 port[dev],
@@ -432,28 +432,20 @@ static int __init snd_sb16_probe(int dev,
432 xdma8, 432 xdma8,
433 xdma16, 433 xdma16,
434 SB_HW_AUTO, 434 SB_HW_AUTO,
435 &chip)) < 0) { 435 &chip)) < 0)
436 snd_card_free(card); 436 goto _err;
437 return err; 437
438 }
439 if (chip->hardware != SB_HW_16) { 438 if (chip->hardware != SB_HW_16) {
440 snd_card_free(card); 439 snd_printk(KERN_ERR PFX "SB 16 chip was not detected at 0x%lx\n", port[dev]);
441 snd_printdd("SB 16 chip was not detected at 0x%lx\n", port[dev]); 440 err = -ENODEV;
442 return -ENODEV; 441 goto _err;
443 } 442 }
444 chip->mpu_port = mpu_port[dev]; 443 chip->mpu_port = mpu_port[dev];
445#ifdef CONFIG_PNP 444 if (! is_isapnp_selected(dev) && (err = snd_sb16dsp_configure(chip)) < 0)
446 if (!isapnp[dev] && (err = snd_sb16dsp_configure(chip)) < 0) { 445 goto _err;
447#else 446
448 if ((err = snd_sb16dsp_configure(chip)) < 0) { 447 if ((err = snd_sb16dsp_pcm(chip, 0, NULL)) < 0)
449#endif 448 goto _err;
450 snd_card_free(card);
451 return -ENXIO;
452 }
453 if ((err = snd_sb16dsp_pcm(chip, 0, NULL)) < 0) {
454 snd_card_free(card);
455 return -ENXIO;
456 }
457 449
458 strcpy(card->driver, 450 strcpy(card->driver,
459#ifdef SNDRV_SBAWE_EMU8000 451#ifdef SNDRV_SBAWE_EMU8000
@@ -474,10 +466,8 @@ static int __init snd_sb16_probe(int dev,
474 if (chip->mpu_port > 0 && chip->mpu_port != SNDRV_AUTO_PORT) { 466 if (chip->mpu_port > 0 && chip->mpu_port != SNDRV_AUTO_PORT) {
475 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_SB, 467 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_SB,
476 chip->mpu_port, 0, 468 chip->mpu_port, 0,
477 xirq, 0, &chip->rmidi)) < 0) { 469 xirq, 0, &chip->rmidi)) < 0)
478 snd_card_free(card); 470 goto _err;
479 return -ENXIO;
480 }
481 chip->rmidi_callback = snd_mpu401_uart_interrupt; 471 chip->rmidi_callback = snd_mpu401_uart_interrupt;
482 } 472 }
483 473
@@ -499,17 +489,13 @@ static int __init snd_sb16_probe(int dev,
499#else 489#else
500 int seqdev = 1; 490 int seqdev = 1;
501#endif 491#endif
502 if ((err = snd_opl3_hwdep_new(opl3, 0, seqdev, &synth)) < 0) { 492 if ((err = snd_opl3_hwdep_new(opl3, 0, seqdev, &synth)) < 0)
503 snd_card_free(card); 493 goto _err;
504 return -ENXIO;
505 }
506 } 494 }
507 } 495 }
508 496
509 if ((err = snd_sbmixer_new(chip)) < 0) { 497 if ((err = snd_sbmixer_new(chip)) < 0)
510 snd_card_free(card); 498 goto _err;
511 return -ENXIO;
512 }
513 499
514#ifdef CONFIG_SND_SB16_CSP 500#ifdef CONFIG_SND_SB16_CSP
515 /* CSP chip on SB16ASP/AWE32 */ 501 /* CSP chip on SB16ASP/AWE32 */
@@ -525,11 +511,11 @@ static int __init snd_sb16_probe(int dev,
525#endif 511#endif
526#ifdef SNDRV_SBAWE_EMU8000 512#ifdef SNDRV_SBAWE_EMU8000
527 if (awe_port[dev] > 0) { 513 if (awe_port[dev] > 0) {
528 if (snd_emu8000_new(card, 1, awe_port[dev], 514 if ((err = snd_emu8000_new(card, 1, awe_port[dev],
529 seq_ports[dev], NULL) < 0) { 515 seq_ports[dev], NULL)) < 0) {
530 snd_printk(KERN_ERR PFX "fatal error - EMU-8000 synthesizer not detected at 0x%lx\n", awe_port[dev]); 516 snd_printk(KERN_ERR PFX "fatal error - EMU-8000 synthesizer not detected at 0x%lx\n", awe_port[dev]);
531 snd_card_free(card); 517
532 return -ENXIO; 518 goto _err;
533 } 519 }
534 } 520 }
535#endif 521#endif
@@ -541,15 +527,21 @@ static int __init snd_sb16_probe(int dev,
541 (mic_agc[dev] ? 0x00 : 0x01)); 527 (mic_agc[dev] ? 0x00 : 0x01));
542 spin_unlock_irqrestore(&chip->mixer_lock, flags); 528 spin_unlock_irqrestore(&chip->mixer_lock, flags);
543 529
544 if ((err = snd_card_register(card)) < 0) { 530 if ((err = snd_card_set_generic_dev(card)) < 0)
545 snd_card_free(card); 531 goto _err;
546 return err; 532
547 } 533 if ((err = snd_card_register(card)) < 0)
534 goto _err;
535
548 if (pcard) 536 if (pcard)
549 pnp_set_card_drvdata(pcard, card); 537 pnp_set_card_drvdata(pcard, card);
550 else 538 else
551 snd_sb16_legacy[dev] = card; 539 snd_sb16_legacy[dev] = card;
552 return 0; 540 return 0;
541
542 _err:
543 snd_card_free(card);
544 return err;
553} 545}
554 546
555static int __init snd_sb16_probe_legacy_port(unsigned long xport) 547static int __init snd_sb16_probe_legacy_port(unsigned long xport)
@@ -560,10 +552,8 @@ static int __init snd_sb16_probe_legacy_port(unsigned long xport)
560 for ( ; dev < SNDRV_CARDS; dev++) { 552 for ( ; dev < SNDRV_CARDS; dev++) {
561 if (!enable[dev] || port[dev] != SNDRV_AUTO_PORT) 553 if (!enable[dev] || port[dev] != SNDRV_AUTO_PORT)
562 continue; 554 continue;
563#ifdef CONFIG_PNP 555 if (is_isapnp_selected(dev))
564 if (isapnp[dev])
565 continue; 556 continue;
566#endif
567 port[dev] = xport; 557 port[dev] = xport;
568 res = snd_sb16_probe(dev, NULL, NULL); 558 res = snd_sb16_probe(dev, NULL, NULL);
569 if (res < 0) 559 if (res < 0)
@@ -621,10 +611,8 @@ static int __init alsa_card_sb16_init(void)
621 for (dev = 0; dev < SNDRV_CARDS; dev++) { 611 for (dev = 0; dev < SNDRV_CARDS; dev++) {
622 if (!enable[dev] || port[dev] == SNDRV_AUTO_PORT) 612 if (!enable[dev] || port[dev] == SNDRV_AUTO_PORT)
623 continue; 613 continue;
624#ifdef CONFIG_PNP 614 if (is_isapnp_selected(dev))
625 if (isapnp[dev])
626 continue; 615 continue;
627#endif
628 if (!snd_sb16_probe(dev, NULL, NULL)) { 616 if (!snd_sb16_probe(dev, NULL, NULL)) {
629 cards++; 617 cards++;
630 continue; 618 continue;
diff --git a/sound/isa/sb/sb8.c b/sound/isa/sb/sb8.c
index e2cbc4202b3d..c41ac25e85ca 100644
--- a/sound/isa/sb/sb8.c
+++ b/sound/isa/sb/sb8.c
@@ -107,54 +107,47 @@ static int __init snd_sb8_probe(int dev)
107 dma8[dev], 107 dma8[dev],
108 -1, 108 -1,
109 SB_HW_AUTO, 109 SB_HW_AUTO,
110 &chip)) < 0) { 110 &chip)) < 0)
111 snd_card_free(card); 111 goto _err;
112 return err; 112
113 }
114 if (chip->hardware >= SB_HW_16) { 113 if (chip->hardware >= SB_HW_16) {
115 snd_card_free(card);
116 if (chip->hardware == SB_HW_ALS100) 114 if (chip->hardware == SB_HW_ALS100)
117 snd_printdd("ALS100 chip detected at 0x%lx, try snd-als100 module\n", 115 snd_printk(KERN_WARNING "ALS100 chip detected at 0x%lx, try snd-als100 module\n",
118 port[dev]); 116 port[dev]);
119 else 117 else
120 snd_printdd("SB 16 chip detected at 0x%lx, try snd-sb16 module\n", 118 snd_printk(KERN_WARNING "SB 16 chip detected at 0x%lx, try snd-sb16 module\n",
121 port[dev]); 119 port[dev]);
122 return -ENODEV; 120 err = -ENODEV;
121 goto _err;
123 } 122 }
124 123
125 if ((err = snd_sb8dsp_pcm(chip, 0, NULL)) < 0) { 124 if ((err = snd_sb8dsp_pcm(chip, 0, NULL)) < 0)
126 snd_card_free(card); 125 goto _err;
127 return err; 126
128 } 127 if ((err = snd_sbmixer_new(chip)) < 0)
129 if ((err = snd_sbmixer_new(chip)) < 0) { 128 goto _err;
130 snd_card_free(card); 129
131 return err;
132 }
133 if (chip->hardware == SB_HW_10 || chip->hardware == SB_HW_20) { 130 if (chip->hardware == SB_HW_10 || chip->hardware == SB_HW_20) {
134 if ((err = snd_opl3_create(card, chip->port + 8, 0, 131 if ((err = snd_opl3_create(card, chip->port + 8, 0,
135 OPL3_HW_AUTO, 1, 132 OPL3_HW_AUTO, 1,
136 &opl3)) < 0) { 133 &opl3)) < 0) {
137 snd_printk(KERN_ERR "sb8: no OPL device at 0x%lx\n", chip->port + 8); 134 snd_printk(KERN_WARNING "sb8: no OPL device at 0x%lx\n", chip->port + 8);
138 } 135 }
139 } else { 136 } else {
140 if ((err = snd_opl3_create(card, chip->port, chip->port + 2, 137 if ((err = snd_opl3_create(card, chip->port, chip->port + 2,
141 OPL3_HW_AUTO, 1, 138 OPL3_HW_AUTO, 1,
142 &opl3)) < 0) { 139 &opl3)) < 0) {
143 snd_printk(KERN_ERR "sb8: no OPL device at 0x%lx-0x%lx\n", 140 snd_printk(KERN_WARNING "sb8: no OPL device at 0x%lx-0x%lx\n",
144 chip->port, chip->port + 2); 141 chip->port, chip->port + 2);
145 } 142 }
146 } 143 }
147 if (err >= 0) { 144 if (err >= 0) {
148 if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { 145 if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0)
149 snd_card_free(card); 146 goto _err;
150 return err;
151 }
152 } 147 }
153 148
154 if ((err = snd_sb8dsp_midi(chip, 0, NULL)) < 0) { 149 if ((err = snd_sb8dsp_midi(chip, 0, NULL)) < 0)
155 snd_card_free(card); 150 goto _err;
156 return err;
157 }
158 151
159 strcpy(card->driver, chip->hardware == SB_HW_PRO ? "SB Pro" : "SB8"); 152 strcpy(card->driver, chip->hardware == SB_HW_PRO ? "SB Pro" : "SB8");
160 strcpy(card->shortname, chip->name); 153 strcpy(card->shortname, chip->name);
@@ -162,12 +155,19 @@ static int __init snd_sb8_probe(int dev)
162 chip->name, 155 chip->name,
163 chip->port, 156 chip->port,
164 irq[dev], dma8[dev]); 157 irq[dev], dma8[dev]);
165 if ((err = snd_card_register(card)) < 0) { 158
166 snd_card_free(card); 159 if ((err = snd_card_set_generic_dev(card)) < 0)
167 return err; 160 goto _err;
168 } 161
162 if ((err = snd_card_register(card)) < 0)
163 goto _err;
164
169 snd_sb8_cards[dev] = card; 165 snd_sb8_cards[dev] = card;
170 return 0; 166 return 0;
167
168 _err:
169 snd_card_free(card);
170 return err;
171} 171}
172 172
173static int __init snd_card_sb8_legacy_auto_probe(unsigned long xport) 173static int __init snd_card_sb8_legacy_auto_probe(unsigned long xport)
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
68static snd_card_t *snd_sgalaxy_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; 68static 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)
160static int __init snd_sgalaxy_detect(int dev, int irq, int dma) 162static 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
295static int __init alsa_card_sgalaxy_init(void) 296static int __init alsa_card_sgalaxy_init(void)
diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c
index 3959ed694eec..9f6b58c79209 100644
--- a/sound/isa/sscape.c
+++ b/sound/isa/sscape.c
@@ -1262,11 +1262,6 @@ static int __devinit create_sscape(const struct params *params, snd_card_t **rca
1262 */ 1262 */
1263 sscape_write(sscape, GA_INTENA_REG, 0x80); 1263 sscape_write(sscape, GA_INTENA_REG, 0x80);
1264 1264
1265 if ((err = snd_card_register(card)) < 0) {
1266 printk(KERN_ERR "sscape: Failed to register sound card\n");
1267 goto _release_card;
1268 }
1269
1270 /* 1265 /*
1271 * Initialize mixer 1266 * Initialize mixer
1272 */ 1267 */
@@ -1396,6 +1391,13 @@ static int __devinit sscape_pnp_detect(struct pnp_card_link *pcard,
1396 if (ret < 0) 1391 if (ret < 0)
1397 return ret; 1392 return ret;
1398 snd_card_set_dev(card, &pcard->card->dev); 1393 snd_card_set_dev(card, &pcard->card->dev);
1394
1395 if ((ret = snd_card_register(card)) < 0) {
1396 printk(KERN_ERR "sscape: Failed to register sound card\n");
1397 snd_card_free(card);
1398 return ret;
1399 }
1400
1399 pnp_set_card_drvdata(pcard, card); 1401 pnp_set_card_drvdata(pcard, card);
1400 ++sscape_cards; 1402 ++sscape_cards;
1401 ++idx; 1403 ++idx;
@@ -1460,6 +1462,16 @@ static int __init sscape_manual_probe(struct params *params)
1460 if (ret < 0) 1462 if (ret < 0)
1461 return ret; 1463 return ret;
1462 1464
1465 if ((ret = snd_card_set_generic_dev(card)) < 0) {
1466 snd_card_free(card);
1467 return ret;
1468 }
1469 if ((ret = snd_card_register(card)) < 0) {
1470 printk(KERN_ERR "sscape: Failed to register sound card\n");
1471 snd_card_free(card);
1472 return ret;
1473 }
1474
1463 sscape_card[sscape_cards] = card; 1475 sscape_card[sscape_cards] = card;
1464 params++; 1476 params++;
1465 sscape_cards++; 1477 sscape_cards++;
diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c
index 79b022070ba3..0a572e0a47e6 100644
--- a/sound/isa/wavefront/wavefront.c
+++ b/sound/isa/wavefront/wavefront.c
@@ -622,6 +622,11 @@ snd_wavefront_probe (int dev, struct pnp_card_link *pcard,
622 ics2115_port[dev], 622 ics2115_port[dev],
623 ics2115_irq[dev]); 623 ics2115_irq[dev]);
624 624
625 if ((err = snd_card_set_generic_dev(card)) < 0) {
626 snd_card_free(card);
627 return err;
628 }
629
625 if ((err = snd_card_register(card)) < 0) { 630 if ((err = snd_card_register(card)) < 0) {
626 snd_card_free(card); 631 snd_card_free(card);
627 return err; 632 return err;