diff options
author | Takashi Iwai <tiwai@suse.de> | 2005-09-05 17:19:20 +0200 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2005-09-12 10:42:01 +0200 |
commit | 43bcd973d6d05d16b876e09dcc49a09d3e48e88d (patch) | |
tree | 8c8493b66c417402f6188051c57e55099bbd156d /sound/isa/gus/gusmax.c | |
parent | 16dab54b8cbac39bd3f639db5d7d0fd8300a6cb0 (diff) | |
download | linux-3.10-43bcd973d6d05d16b876e09dcc49a09d3e48e88d.tar.gz linux-3.10-43bcd973d6d05d16b876e09dcc49a09d3e48e88d.tar.bz2 linux-3.10-43bcd973d6d05d16b876e09dcc49a09d3e48e88d.zip |
[ALSA] Add snd_card_set_generic_dev() call to ISA drivers
ISA,CMI8330 driver,ES18xx driver,OPL3SA2 driver,Sound Galaxy driver
Sound Scape driver,AD1848 driver,CS4231 driver,CS4236+ driver
ES1688 driver,GUS Classic driver,GUS Extreme driver,GUS MAX driver
AMD InterWave driver,Opti9xx drivers,SB16/AWE driver,SB8 driver
Wavefront drivers
- Added snd_card_set_generic_dev() call.
- Added SND_GENERIC_DRIVER to Kconfig.
- Clean up the error path in probe if necessary.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/isa/gus/gusmax.c')
-rw-r--r-- | sound/isa/gus/gusmax.c | 145 |
1 files changed, 62 insertions, 83 deletions
diff --git a/sound/isa/gus/gusmax.c b/sound/isa/gus/gusmax.c index 400ff34710f..0bb44b51934 100644 --- a/sound/isa/gus/gusmax.c +++ b/sound/isa/gus/gusmax.c @@ -82,39 +82,25 @@ struct snd_gusmax { static snd_card_t *snd_gusmax_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; +#define PFX "gusmax: " static int __init snd_gusmax_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; } @@ -239,25 +225,25 @@ static int __init snd_gusmax_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; } } @@ -266,31 +252,28 @@ static int __init snd_gusmax_probe(int dev) -xirq, xdma1, xdma2, 0, channels[dev], pcm_channels[dev], - 0, &gus)) < 0) { - snd_card_free(card); - return err; - } - if ((err = snd_gusmax_detect(gus)) < 0) { - snd_card_free(card); - return err; - } + 0, &gus)) < 0) + goto _err; + + if ((err = snd_gusmax_detect(gus)) < 0) + goto _err; + maxcard->gus_status_reg = gus->gf1.reg_irqstat; maxcard->pcm_status_reg = gus->gf1.port + 0x10c + 2; snd_gusmax_init(dev, card, 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) { - printk(KERN_ERR "GUS MAX soundcard was not detected at 0x%lx\n", gus->gf1.port); - snd_card_free(card); - return -ENODEV; + snd_printk(KERN_ERR PFX "GUS MAX soundcard was not detected at 0x%lx\n", gus->gf1.port); + err = -ENODEV; + goto _err; } if (request_irq(xirq, snd_gusmax_interrupt, SA_INTERRUPT, "GUS MAX", (void *)maxcard)) { - snd_card_free(card); - printk(KERN_ERR "gusmax: unable to grab IRQ %d\n", xirq); - return -EBUSY; + snd_printk(KERN_ERR PFX "unable to grab IRQ %d\n", xirq); + err = -EBUSY; + goto _err; } maxcard->irq = xirq; @@ -301,50 +284,46 @@ static int __init snd_gusmax_probe(int dev) CS4231_HWSHARE_IRQ | CS4231_HWSHARE_DMA1 | CS4231_HWSHARE_DMA2, - &cs4231)) < 0) { - snd_card_free(card); - return err; - } - if ((err = snd_cs4231_pcm(cs4231, 0, NULL)) < 0) { - snd_card_free(card); - return err; - } - if ((err = snd_cs4231_mixer(cs4231)) < 0) { - snd_card_free(card); - return err; - } - if ((err = snd_cs4231_timer(cs4231, 2, NULL)) < 0) { - snd_card_free(card); - return err; - } + &cs4231)) < 0) + goto _err; + + if ((err = snd_cs4231_pcm(cs4231, 0, NULL)) < 0) + goto _err; + + if ((err = snd_cs4231_mixer(cs4231)) < 0) + goto _err; + + if ((err = snd_cs4231_timer(cs4231, 2, NULL)) < 0) + goto _err; + if (pcm_channels[dev] > 0) { - if ((err = snd_gf1_pcm_new(gus, 1, 1, NULL)) < 0) { - snd_card_free(card); - return err; - } - } - if ((err = snd_gusmax_mixer(cs4231)) < 0) { - snd_card_free(card); - return err; + if ((err = snd_gf1_pcm_new(gus, 1, 1, NULL)) < 0) + goto _err; } + if ((err = snd_gusmax_mixer(cs4231)) < 0) + goto _err; - 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 %i, dma %i", gus->gf1.port, xirq, xdma1); if (xdma2 >= 0) sprintf(card->longname + strlen(card->longname), "&%i", 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; maxcard->gus = gus; maxcard->cs4231 = cs4231; snd_gusmax_cards[dev] = card; return 0; + + _err: + snd_card_free(card); + return err; } static int __init snd_gusmax_legacy_auto_probe(unsigned long xport) |