From 43bcd973d6d05d16b876e09dcc49a09d3e48e88d Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 5 Sep 2005 17:19:20 +0200 Subject: [ALSA] Add snd_card_set_generic_dev() call to ISA drivers ISA,CMI8330 driver,ES18xx driver,OPL3SA2 driver,Sound Galaxy driver Sound Scape driver,AD1848 driver,CS4231 driver,CS4236+ driver ES1688 driver,GUS Classic driver,GUS Extreme driver,GUS MAX driver AMD InterWave driver,Opti9xx drivers,SB16/AWE driver,SB8 driver Wavefront drivers - Added snd_card_set_generic_dev() call. - Added SND_GENERIC_DRIVER to Kconfig. - Clean up the error path in probe if necessary. Signed-off-by: Takashi Iwai --- sound/isa/es1688/es1688.c | 61 +++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 31 deletions(-) (limited to 'sound/isa/es1688') diff --git a/sound/isa/es1688/es1688.c b/sound/isa/es1688/es1688.c index c5eaec0..26a7d33 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) -- cgit v1.1