diff options
-rw-r--r-- | sound/isa/Kconfig | 18 | ||||
-rw-r--r-- | sound/isa/ad1848/ad1848.c | 37 | ||||
-rw-r--r-- | sound/isa/cmi8330.c | 77 | ||||
-rw-r--r-- | sound/isa/cs423x/cs4231.c | 46 | ||||
-rw-r--r-- | sound/isa/cs423x/cs4236.c | 97 | ||||
-rw-r--r-- | sound/isa/es1688/es1688.c | 61 | ||||
-rw-r--r-- | sound/isa/es18xx.c | 81 | ||||
-rw-r--r-- | sound/isa/gus/gusclassic.c | 115 | ||||
-rw-r--r-- | sound/isa/gus/gusextreme.c | 49 | ||||
-rw-r--r-- | sound/isa/gus/gusmax.c | 145 | ||||
-rw-r--r-- | sound/isa/gus/interwave.c | 167 | ||||
-rw-r--r-- | sound/isa/opl3sa2.c | 36 | ||||
-rw-r--r-- | sound/isa/opti9xx/opti92x-ad1848.c | 8 | ||||
-rw-r--r-- | sound/isa/sb/sb16.c | 144 | ||||
-rw-r--r-- | sound/isa/sb/sb8.c | 62 | ||||
-rw-r--r-- | sound/isa/sgalaxy.c | 65 | ||||
-rw-r--r-- | sound/isa/sscape.c | 22 | ||||
-rw-r--r-- | sound/isa/wavefront/wavefront.c | 5 |
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" config SND_AD1848_LIB tristate select SND_PCM - select SND_GENERIC_PM + select SND_GENERIC_DRIVER config SND_CS4231_LIB tristate select SND_PCM - select SND_GENERIC_PM + select SND_GENERIC_DRIVER config SND_AD1816A tristate "Analog Devices SoundPort AD1816A" @@ -97,6 +97,7 @@ config SND_ES1688 select SND_OPL3_LIB select SND_MPU401_UART select SND_PCM + select SND_GENERIC_DRIVER help Say Y here to include support for ESS AudioDrive ES688 or ES1688 chips. @@ -110,7 +111,7 @@ config SND_ES18XX select SND_OPL3_LIB select SND_MPU401_UART select SND_PCM - select SND_GENERIC_PM + select SND_GENERIC_DRIVER help Say Y here to include support for ESS AudioDrive ES18xx chips. @@ -126,6 +127,7 @@ config SND_GUSCLASSIC select SND_RAWMIDI select SND_PCM select SND_GUS_SYNTH + select SND_GENERIC_DRIVER help Say Y here to include support for Gravis UltraSound Classic soundcards. @@ -140,6 +142,7 @@ config SND_GUSEXTREME select SND_MPU401_UART select SND_PCM select SND_GUS_SYNTH + select SND_GENERIC_DRIVER help Say Y here to include support for Gravis UltraSound Extreme soundcards. @@ -153,6 +156,7 @@ config SND_GUSMAX select SND_RAWMIDI select SND_CS4231_LIB select SND_GUS_SYNTH + select SND_GENERIC_DRIVER help Say Y here to include support for Gravis UltraSound MAX soundcards. @@ -166,7 +170,7 @@ config SND_INTERWAVE select SND_RAWMIDI select SND_CS4231_LIB select SND_GUS_SYNTH - select ISAPNP + select SND_GENERIC_DRIVER help Say Y here to include support for AMD InterWave based soundcards (Gravis UltraSound Plug & Play, STB SoundRage32, @@ -181,7 +185,7 @@ config SND_INTERWAVE_STB select SND_RAWMIDI select SND_CS4231_LIB select SND_GUS_SYNTH - select ISAPNP + select SND_GENERIC_DRIVER help Say Y here to include support for AMD InterWave based soundcards with a TEA6330T bass and treble regulator @@ -224,6 +228,7 @@ config SND_OPTI93X select SND_OPL3_LIB select SND_MPU401_UART select SND_PCM + select SND_GENERIC_DRIVER help Say Y here to include support for soundcards based on Opti 82C93x chips. @@ -237,6 +242,7 @@ config SND_SB8 select SND_OPL3_LIB select SND_RAWMIDI select SND_PCM + select SND_GENERIC_DRIVER help Say Y here to include support for Creative Sound Blaster 1.0/ 2.0/Pro (8-bit) or 100% compatible soundcards. @@ -250,6 +256,7 @@ config SND_SB16 select SND_OPL3_LIB select SND_MPU401_UART select SND_PCM + select SND_GENERIC_DRIVER help Say Y here to include support for Sound Blaster 16 soundcards (including the Plug and Play version). @@ -263,6 +270,7 @@ config SND_SBAWE select SND_OPL3_LIB select SND_MPU401_UART select SND_PCM + select SND_GENERIC_DRIVER help Say Y here to include support for Sound Blaster AWE soundcards (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) irq[dev], dma1[dev], thinkpad[dev] ? AD1848_HW_THINKPAD : AD1848_HW_DETECT, - &chip)) < 0) { - snd_card_free(card); - return err; - } + &chip)) < 0) + goto _err; + + if ((err = snd_ad1848_pcm(chip, 0, &pcm)) < 0) + goto _err; + + if ((err = snd_ad1848_mixer(chip)) < 0) + goto _err; - if ((err = snd_ad1848_pcm(chip, 0, &pcm)) < 0) { - snd_card_free(card); - return err; - } - if ((err = snd_ad1848_mixer(chip)) < 0) { - snd_card_free(card); - return err; - } strcpy(card->driver, "AD1848"); strcpy(card->shortname, pcm->name); sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d", pcm->name, chip->port, irq[dev], dma1[dev]); - if (thinkpad[dev]) { + if (thinkpad[dev]) strcat(card->longname, " [Thinkpad]"); - } - if ((err = snd_card_register(card)) < 0) { - snd_card_free(card); - return err; - } + if ((err = snd_card_set_generic_dev(card)) < 0) + goto _err; + + if ((err = snd_card_register(card)) < 0) + goto _err; + snd_ad1848_cards[dev] = card; return 0; + + _err: + snd_card_free(card); + return err; } static 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) /* */ +#ifdef CONFIG_PNP +#define is_isapnp_selected(dev) isapnp[dev] +#else +#define is_isapnp_selected(dev) 0 +#endif + +#define PFX "cmi8330: " + static int __devinit snd_cmi8330_probe(int dev, struct pnp_card_link *pcard, const struct pnp_card_device_id *pid) { snd_card_t *card; struct snd_cmi8330 *acard; - unsigned long flags; int i, err; -#ifdef CONFIG_PNP - if (!isapnp[dev]) { -#endif + if (! is_isapnp_selected(dev)) { if (wssport[dev] == SNDRV_AUTO_PORT) { - snd_printk("specify wssport\n"); + snd_printk(KERN_ERR PFX "specify wssport\n"); return -EINVAL; } if (sbport[dev] == SNDRV_AUTO_PORT) { - snd_printk("specify sbport\n"); + snd_printk(KERN_ERR PFX "specify sbport\n"); return -EINVAL; } -#ifdef CONFIG_PNP } -#endif + card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct snd_cmi8330)); if (card == NULL) { - snd_printk("could not get a new card\n"); + snd_printk(KERN_ERR PFX "could not get a new card\n"); return -ENOMEM; } acard = (struct snd_cmi8330 *)card->private_data; @@ -473,9 +477,8 @@ static int __devinit snd_cmi8330_probe(int dev, #ifdef CONFIG_PNP if (isapnp[dev]) { if ((err = snd_cmi8330_pnp(dev, acard, pcard, pid)) < 0) { - snd_printk("PnP detection failed\n"); - snd_card_free(card); - return err; + snd_printk(KERN_ERR PFX "PnP detection failed\n"); + goto _err; } snd_card_set_dev(card, &pcard->card->dev); } @@ -487,14 +490,13 @@ static int __devinit snd_cmi8330_probe(int dev, wssdma[dev], AD1848_HW_DETECT, &acard->wss)) < 0) { - snd_printk("(AD1848) device busy??\n"); - snd_card_free(card); - return err; + snd_printk(KERN_ERR PFX "(AD1848) device busy??\n"); + goto _err; } if (acard->wss->hardware != AD1848_HW_CMI8330) { - snd_printk("(AD1848) not found during probe\n"); - snd_card_free(card); - return -ENODEV; + snd_printk(KERN_ERR PFX "(AD1848) not found during probe\n"); + err = -ENODEV; + goto _err; } if ((err = snd_sbdsp_create(card, sbport[dev], @@ -503,32 +505,26 @@ static int __devinit snd_cmi8330_probe(int dev, sbdma8[dev], sbdma16[dev], SB_HW_AUTO, &acard->sb)) < 0) { - snd_printk("(SB16) device busy??\n"); - snd_card_free(card); - return err; + snd_printk(KERN_ERR PFX "(SB16) device busy??\n"); + goto _err; } if (acard->sb->hardware != SB_HW_16) { - snd_printk("(SB16) not found during probe\n"); - snd_card_free(card); - return -ENODEV; + snd_printk(KERN_ERR PFX "(SB16) not found during probe\n"); + goto _err; } - spin_lock_irqsave(&acard->wss->reg_lock, flags); snd_ad1848_out(acard->wss, AD1848_MISC_INFO, 0x40); /* switch on MODE2 */ for (i = CMI8330_RMUX3D; i <= CMI8330_CDINGAIN; i++) snd_ad1848_out(acard->wss, i, snd_cmi8330_image[i - CMI8330_RMUX3D]); - spin_unlock_irqrestore(&acard->wss->reg_lock, flags); if ((err = snd_cmi8330_mixer(card, acard)) < 0) { - snd_printk("failed to create mixers\n"); - snd_card_free(card); - return err; + snd_printk(KERN_ERR PFX "failed to create mixers\n"); + goto _err; } if ((err = snd_cmi8330_pcm(card, acard)) < 0) { - snd_printk("failed to create pcms\n"); - snd_card_free(card); - return err; + snd_printk(KERN_ERR PFX "failed to create pcms\n"); + goto _err; } strcpy(card->driver, "CMI8330/C3D"); @@ -539,16 +535,21 @@ static int __devinit snd_cmi8330_probe(int dev, wssirq[dev], wssdma[dev]); - if ((err = snd_card_register(card)) < 0) { - snd_card_free(card); - return err; - } + if ((err = snd_card_set_generic_dev(card)) < 0) + goto _err; + + if ((err = snd_card_register(card)) < 0) + goto _err; if (pcard) pnp_set_card_drvdata(pcard, card); else snd_cmi8330_legacy[dev] = card; return 0; + + _err: + snd_card_free(card); + return err; } #ifdef CONFIG_PNP @@ -594,10 +595,8 @@ static int __init alsa_card_cmi8330_init(void) for (dev = 0; dev < SNDRV_CARDS; dev++) { if (!enable[dev]) continue; -#ifdef CONFIG_PNP - if (isapnp[dev]) + if (is_isapnp_selected(dev)) continue; -#endif if (snd_cmi8330_probe(dev, NULL, NULL) >= 0) cards++; } 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) int err; if (port[dev] == SNDRV_AUTO_PORT) { - snd_printk("specify port\n"); + snd_printk(KERN_ERR "specify port\n"); return -EINVAL; } if (irq[dev] == SNDRV_AUTO_IRQ) { - snd_printk("specify irq\n"); + snd_printk(KERN_ERR "specify irq\n"); return -EINVAL; } if (dma1[dev] == SNDRV_AUTO_DMA) { - snd_printk("specify dma1\n"); + snd_printk(KERN_ERR "specify dma1\n"); return -EINVAL; } card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); @@ -96,15 +96,11 @@ static int __init snd_card_cs4231_probe(int dev) dma1[dev], dma2[dev], CS4231_HW_DETECT, - 0, &chip)) < 0) { - snd_card_free(card); - return err; - } + 0, &chip)) < 0) + goto _err; - if ((err = snd_cs4231_pcm(chip, 0, &pcm)) < 0) { - snd_card_free(card); - return err; - } + if ((err = snd_cs4231_pcm(chip, 0, &pcm)) < 0) + goto _err; strcpy(card->driver, "CS4231"); strcpy(card->shortname, pcm->name); @@ -113,14 +109,10 @@ static int __init snd_card_cs4231_probe(int dev) if (dma2[dev] >= 0) sprintf(card->longname + strlen(card->longname), "&%d", dma2[dev]); - if ((err = snd_cs4231_mixer(chip)) < 0) { - snd_card_free(card); - return err; - } - if ((err = snd_cs4231_timer(chip, 0, NULL)) < 0) { - snd_card_free(card); - return err; - } + if ((err = snd_cs4231_mixer(chip)) < 0) + goto _err; + if ((err = snd_cs4231_timer(chip, 0, NULL)) < 0) + goto _err; if (mpu_port[dev] > 0 && mpu_port[dev] != SNDRV_AUTO_PORT) { if (mpu_irq[dev] == SNDRV_AUTO_IRQ) @@ -130,14 +122,20 @@ static int __init snd_card_cs4231_probe(int dev) mpu_irq[dev], mpu_irq[dev] >= 0 ? SA_INTERRUPT : 0, NULL) < 0) - printk(KERN_ERR "cs4231: MPU401 not detected\n"); - } - if ((err = snd_card_register(card)) < 0) { - snd_card_free(card); - return err; + printk(KERN_WARNING "cs4231: MPU401 not detected\n"); } + + if ((err = snd_card_set_generic_dev(card)) < 0) + goto _err; + + if ((err = snd_card_register(card)) < 0) + goto _err; snd_cs4231_cards[dev] = card; return 0; + + _err: + snd_card_free(card); + return err; } static 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) } } +#ifdef CONFIG_PNP +#define is_isapnp_selected(dev) isapnp[dev] +#else +#define is_isapnp_selected(dev) 0 +#endif + static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard, const struct pnp_card_device_id *pid) { @@ -397,20 +403,16 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard, opl3_t *opl3; int err; -#ifdef CONFIG_PNP - if (!isapnp[dev]) { -#endif + if (! is_isapnp_selected(dev)) { if (port[dev] == SNDRV_AUTO_PORT) { - snd_printk("specify port\n"); + snd_printk(KERN_ERR "specify port\n"); return -EINVAL; } if (cport[dev] == SNDRV_AUTO_PORT) { - snd_printk("specify cport\n"); + snd_printk(KERN_ERR "specify cport\n"); return -EINVAL; } -#ifdef CONFIG_PNP } -#endif card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct snd_card_cs4236)); if (card == NULL) @@ -421,8 +423,7 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard, if (isapnp[dev]) { if ((err = snd_card_cs4236_pnp(dev, acard, pcard, pid))<0) { printk(KERN_ERR "isapnp detection failed and probing for " IDENT " is not supported\n"); - snd_card_free(card); - return -ENXIO; + goto _err; } snd_card_set_dev(card, &pcard->card->dev); } @@ -430,8 +431,8 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard, if (sb_port[dev] > 0 && sb_port[dev] != SNDRV_AUTO_PORT) if ((acard->res_sb_port = request_region(sb_port[dev], 16, IDENT " SB")) == NULL) { printk(KERN_ERR IDENT ": unable to register SB port at 0x%lx\n", sb_port[dev]); - snd_card_free(card); - return -ENOMEM; + err = -EBUSY; + goto _err; } #ifdef CS4232 @@ -443,18 +444,14 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard, dma2[dev], CS4231_HW_DETECT, 0, - &chip)) < 0) { - snd_card_free(card); - return err; - } - if ((err = snd_cs4231_pcm(chip, 0, &pcm)) < 0) { - snd_card_free(card); - return err; - } - if ((err = snd_cs4231_mixer(chip)) < 0) { - snd_card_free(card); - return err; - } + &chip)) < 0) + goto _err; + + if ((err = snd_cs4231_pcm(chip, 0, &pcm)) < 0) + goto _err; + + if ((err = snd_cs4231_mixer(chip)) < 0) + goto _err; #else /* CS4236 */ if ((err = snd_cs4236_create(card, @@ -465,18 +462,14 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard, dma2[dev], CS4231_HW_DETECT, 0, - &chip)) < 0) { - snd_card_free(card); - return err; - } - if ((err = snd_cs4236_pcm(chip, 0, &pcm)) < 0) { - snd_card_free(card); - return err; - } - if ((err = snd_cs4236_mixer(chip)) < 0) { - snd_card_free(card); - return err; - } + &chip)) < 0) + goto _err; + + if ((err = snd_cs4236_pcm(chip, 0, &pcm)) < 0) + goto _err; + + if ((err = snd_cs4236_mixer(chip)) < 0) + goto _err; #endif strcpy(card->driver, pcm->name); strcpy(card->shortname, pcm->name); @@ -488,21 +481,17 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard, if (dma2[dev] >= 0) sprintf(card->longname + strlen(card->longname), "&%d", dma2[dev]); - if ((err = snd_cs4231_timer(chip, 0, NULL)) < 0) { - snd_card_free(card); - return err; - } + if ((err = snd_cs4231_timer(chip, 0, NULL)) < 0) + goto _err; if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) { if (snd_opl3_create(card, fm_port[dev], fm_port[dev] + 2, OPL3_HW_OPL3_CS, 0, &opl3) < 0) { - printk(KERN_ERR IDENT ": OPL3 not detected\n"); + printk(KERN_WARNING IDENT ": OPL3 not detected\n"); } else { - if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { - snd_card_free(card); - return err; - } + if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) + goto _err; } } @@ -513,17 +502,23 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard, mpu_port[dev], 0, mpu_irq[dev], mpu_irq[dev] >= 0 ? SA_INTERRUPT : 0, NULL) < 0) - printk(KERN_ERR IDENT ": MPU401 not detected\n"); - } - if ((err = snd_card_register(card)) < 0) { - snd_card_free(card); - return err; + printk(KERN_WARNING IDENT ": MPU401 not detected\n"); } + + if ((err = snd_card_set_generic_dev(card)) < 0) + goto _err; + + if ((err = snd_card_register(card)) < 0) + goto _err; if (pcard) pnp_set_card_drvdata(pcard, card); else snd_cs4236_legacy[dev] = card; return 0; + + _err: + snd_card_free(card); + return err; } #ifdef CONFIG_PNP @@ -569,10 +564,8 @@ static int __init alsa_card_cs423x_init(void) for (dev = 0; dev < SNDRV_CARDS; dev++) { if (!enable[dev]) continue; -#ifdef CONFIG_PNP - if (isapnp[dev]) + if (is_isapnp_selected(dev)) continue; -#endif if (snd_card_cs423x_probe(dev, NULL, NULL) >= 0) cards++; } 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."); static snd_card_t *snd_audiodrive_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; +#define PFX "es1688: " static int __init snd_audiodrive_probe(int dev) { @@ -89,47 +90,41 @@ static int __init snd_audiodrive_probe(int dev) xirq = irq[dev]; if (xirq == SNDRV_AUTO_IRQ) { if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { - snd_card_free(card); - snd_printk("unable to find a free IRQ\n"); - return -EBUSY; + snd_printk(KERN_ERR PFX "unable to find a free IRQ\n"); + err = -EBUSY; + goto _err; } } xmpu_irq = mpu_irq[dev]; xdma = dma8[dev]; if (xdma == SNDRV_AUTO_DMA) { if ((xdma = snd_legacy_find_free_dma(possible_dmas)) < 0) { - snd_card_free(card); - snd_printk("unable to find a free DMA\n"); - return -EBUSY; + snd_printk(KERN_ERR PFX "unable to find a free DMA\n"); + err = -EBUSY; + goto _err; } } if ((err = snd_es1688_create(card, port[dev], mpu_port[dev], xirq, xmpu_irq, xdma, - ES1688_HW_AUTO, &chip)) < 0) { - snd_card_free(card); - return err; - } - if ((err = snd_es1688_pcm(chip, 0, &pcm)) < 0) { - snd_card_free(card); - return err; - } - if ((err = snd_es1688_mixer(chip)) < 0) { - snd_card_free(card); - return err; - } + ES1688_HW_AUTO, &chip)) < 0) + goto _err; + + if ((err = snd_es1688_pcm(chip, 0, &pcm)) < 0) + goto _err; + + if ((err = snd_es1688_mixer(chip)) < 0) + goto _err; strcpy(card->driver, "ES1688"); strcpy(card->shortname, pcm->name); sprintf(card->longname, "%s at 0x%lx, irq %i, dma %i", pcm->name, chip->port, xirq, xdma); if ((snd_opl3_create(card, chip->port, chip->port + 2, OPL3_HW_OPL3, 0, &opl3)) < 0) { - printk(KERN_ERR "es1688: opl3 not detected at 0x%lx\n", chip->port); + printk(KERN_WARNING PFX "opl3 not detected at 0x%lx\n", chip->port); } else { - if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { - snd_card_free(card); - return err; - } + if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) + goto _err; } 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) chip->mpu_port, 0, xmpu_irq, SA_INTERRUPT, - NULL)) < 0) { - snd_card_free(card); - return err; - } - } - if ((err = snd_card_register(card)) < 0) { - snd_card_free(card); - return err; + NULL)) < 0) + goto _err; } + + if ((err = snd_card_set_generic_dev(card)) < 0) + goto _err; + + if ((err = snd_card_register(card)) < 0) + goto _err; + snd_audiodrive_cards[dev] = card; return 0; + _err: + snd_card_free(card); + return err; } static 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, } #endif /* CONFIG_PNP */ +#ifdef CONFIG_PNP +#define is_isapnp_selected(dev) isapnp[dev] +#else +#define is_isapnp_selected(dev) 0 +#endif + static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard, const struct pnp_card_device_id *pid) { @@ -1996,7 +2002,6 @@ static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard, int xirq, xdma1, xdma2; snd_card_t *card; struct snd_audiodrive *acard; - snd_rawmidi_t *rmidi = NULL; es18xx_t *chip; opl3_t *opl3; int err; @@ -2019,25 +2024,25 @@ static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard, xirq = irq[dev]; if (xirq == SNDRV_AUTO_IRQ) { if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { - snd_card_free(card); - snd_printk("unable to find a free IRQ\n"); - return -EBUSY; + snd_printk(KERN_ERR PFX "unable to find a free IRQ\n"); + err = -EBUSY; + goto _err; } } xdma1 = dma1[dev]; if (xdma1 == SNDRV_AUTO_DMA) { if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) { - snd_card_free(card); - snd_printk("unable to find a free DMA1\n"); - return -EBUSY; + snd_printk(KERN_ERR PFX "unable to find a free DMA1\n"); + err = -EBUSY; + goto _err; } } xdma2 = dma2[dev]; if (xdma2 == SNDRV_AUTO_DMA) { if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) { - snd_card_free(card); - snd_printk("unable to find a free DMA2\n"); - return -EBUSY; + snd_printk(KERN_ERR PFX "unable to find a free DMA2\n"); + err = -EBUSY; + goto _err; } } @@ -2046,10 +2051,8 @@ static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard, mpu_port[dev], fm_port[dev], xirq, xdma1, xdma2, - &chip)) < 0) { - snd_card_free(card); - return err; - } + &chip)) < 0) + goto _err; sprintf(card->driver, "ES%x", chip->version); 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, chip->port, xirq, xdma1); - if ((err = snd_es18xx_pcm(chip, 0, NULL)) < 0) { - snd_card_free(card); - return err; - } - if ((err = snd_es18xx_mixer(chip)) < 0) { - snd_card_free(card); - return err; - } + if ((err = snd_es18xx_pcm(chip, 0, NULL)) < 0) + goto _err; + + if ((err = snd_es18xx_mixer(chip)) < 0) + goto _err; if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) { if (snd_opl3_create(card, chip->fm_port, chip->fm_port + 2, OPL3_HW_OPL3, 0, &opl3) < 0) { - snd_printk(KERN_ERR PFX "opl3 not detected at 0x%lx\n", chip->fm_port); + snd_printk(KERN_WARNING PFX "opl3 not detected at 0x%lx\n", chip->fm_port); } else { - if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { - snd_card_free(card); - return err; - } + if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) + goto _err; } } @@ -2088,25 +2086,28 @@ static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard, if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_ES18XX, chip->mpu_port, 0, xirq, 0, - &rmidi)) < 0) { - snd_card_free(card); - return err; - } - chip->rmidi = rmidi; + &chip->rmidi)) < 0) + goto _err; } + if ((err = snd_card_set_generic_dev(card)) < 0) + goto _err; + /* Power Management */ snd_card_set_isa_pm_callback(card, snd_es18xx_suspend, snd_es18xx_resume, chip); - if ((err = snd_card_register(card)) < 0) { - snd_card_free(card); - return err; - } + if ((err = snd_card_register(card)) < 0) + goto _err; + if (pcard) pnp_set_card_drvdata(pcard, card); else snd_audiodrive_legacy[dev] = card; return 0; + + _err: + snd_card_free(card); + return err; } static 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) for ( ; dev < SNDRV_CARDS; dev++) { if (!enable[dev] || port[dev] != SNDRV_AUTO_PORT) continue; -#ifdef CONFIG_PNP - if (isapnp[dev]) + if (is_isapnp_selected(dev)) continue; -#endif port[dev] = xport; res = snd_audiodrive_probe(dev, NULL, NULL); if (res < 0) @@ -2177,10 +2176,8 @@ static int __init alsa_card_es18xx_init(void) for (dev = 0; dev < SNDRV_CARDS; dev++) { if (!enable[dev] || port[dev] == SNDRV_AUTO_PORT) continue; -#ifdef CONFIG_PNP - if (isapnp[dev]) + if (is_isapnp_selected(dev)) continue; -#endif if (snd_audiodrive_probe(dev, NULL, NULL) >= 0) cards++; } 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."); static snd_card_t *snd_gusclassic_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; +#define PFX "gusclassic: " static int __init snd_gusclassic_detect(snd_gus_card_t * gus) { - snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0); /* reset GF1 */ -#ifdef CONFIG_SND_DEBUG_DETECT - { - unsigned char d; + unsigned char d; - if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) { - snd_printk("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d); - return -ENODEV; - } - } -#else - if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 0) + snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0); /* reset GF1 */ + if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) { + snd_printdd("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d); return -ENODEV; -#endif + } udelay(160); snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1); /* release reset */ udelay(160); -#ifdef CONFIG_SND_DEBUG_DETECT - { - unsigned char d; - - if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) { - snd_printk("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d); - return -ENODEV; - } - } -#else - if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 1) + if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) { + snd_printdd("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d); return -ENODEV; -#endif - + } return 0; } @@ -137,25 +121,25 @@ static int __init snd_gusclassic_probe(int dev) xirq = irq[dev]; if (xirq == SNDRV_AUTO_IRQ) { if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { - snd_card_free(card); - snd_printk("unable to find a free IRQ\n"); - return -EBUSY; + snd_printk(KERN_ERR PFX "unable to find a free IRQ\n"); + err = -EBUSY; + goto _err; } } xdma1 = dma1[dev]; if (xdma1 == SNDRV_AUTO_DMA) { if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) { - snd_card_free(card); - snd_printk("unable to find a free DMA1\n"); - return -EBUSY; + snd_printk(KERN_ERR PFX "unable to find a free DMA1\n"); + err = -EBUSY; + goto _err; } } xdma2 = dma2[dev]; if (xdma2 == SNDRV_AUTO_DMA) { if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) { - snd_card_free(card); - snd_printk("unable to find a free DMA2\n"); - return -EBUSY; + snd_printk(KERN_ERR PFX "unable to find a free DMA2\n"); + err = -EBUSY; + goto _err; } } @@ -164,47 +148,48 @@ static int __init snd_gusclassic_probe(int dev) port[dev], xirq, xdma1, xdma2, 0, channels[dev], pcm_channels[dev], - 0, &gus)) < 0) { - snd_card_free(card); - return err; - } - if ((err = snd_gusclassic_detect(gus)) < 0) { - snd_card_free(card); - return err; - } + 0, &gus)) < 0) + goto _err; + + if ((err = snd_gusclassic_detect(gus)) < 0) + goto _err; + snd_gusclassic_init(dev, gus); - if ((err = snd_gus_initialize(gus)) < 0) { - snd_card_free(card); - return err; - } + if ((err = snd_gus_initialize(gus)) < 0) + goto _err; + if (gus->max_flag || gus->ess_flag) { - snd_printdd("GUS Classic or ACE soundcard was not detected at 0x%lx\n", gus->gf1.port); - snd_card_free(card); - return -ENODEV; - } - if ((err = snd_gf1_new_mixer(gus)) < 0) { - snd_card_free(card); - return err; - } - if ((err = snd_gf1_pcm_new(gus, 0, 0, NULL)) < 0) { - snd_card_free(card); - return err; + snd_printk(KERN_ERR PFX "GUS Classic or ACE soundcard was not detected at 0x%lx\n", gus->gf1.port); + err = -ENODEV; + goto _err; } + + if ((err = snd_gf1_new_mixer(gus)) < 0) + goto _err; + + if ((err = snd_gf1_pcm_new(gus, 0, 0, NULL)) < 0) + goto _err; + if (!gus->ace_flag) { - if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0) { - snd_card_free(card); - return err; - } + if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0) + goto _err; } sprintf(card->longname + strlen(card->longname), " at 0x%lx, irq %d, dma %d", gus->gf1.port, xirq, xdma1); if (dma2 >= 0) sprintf(card->longname + strlen(card->longname), "&%d", xdma2); - if ((err = snd_card_register(card)) < 0) { - snd_card_free(card); - return err; - } + + if ((err = snd_card_set_generic_dev(card)) < 0) + goto _err; + + if ((err = snd_card_register(card)) < 0) + goto _err; + snd_gusclassic_cards[dev] = card; return 0; + + _err: + snd_card_free(card); + return err; } static int |