aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@suse.cz>2005-01-03 16:14:10 +0100
committerJaroslav Kysela <perex@suse.cz>2005-01-03 16:14:10 +0100
commite60eb4ccd4babc0ae2a24ac4e2c8db4e27ed7f7e (patch)
tree8c04233a689eefe218dea54ae8b88530ddc7b4d5 /sound
parentd6d4c514b69b215c2bc5820717382e3dc28ae4fe (diff)
downloadhistory-e60eb4ccd4babc0ae2a24ac4e2c8db4e27ed7f7e.tar.gz
[ALSA] Fix the order of creation of instances
AZT3328 driver,CMIPCI driver,CS4281 driver,ENS1370/1+ driver Maestro3 driver,SonicVibes driver,CS46xx driver,KORG1212 driver NM256 driver,Trident driver,YMFPCI driver Make sure that the chip instance is created at first before other components. This will fix occasional oops at unloading due to the access to the released resources. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/azt3328.c8
-rw-r--r--sound/pci/cmipci.c25
-rw-r--r--sound/pci/cs4281.c8
-rw-r--r--sound/pci/cs46xx/cs46xx_lib.c8
-rw-r--r--sound/pci/ens1370.c3
-rw-r--r--sound/pci/korg1212/korg1212.c22
-rw-r--r--sound/pci/maestro3.c32
-rw-r--r--sound/pci/nm256/nm256.c12
-rw-r--r--sound/pci/sonicvibes.c3
-rw-r--r--sound/pci/trident/trident_main.c12
-rw-r--r--sound/pci/ymfpci/ymfpci_main.c4
11 files changed, 61 insertions, 76 deletions
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c
index d7703cbf119082..612794256ea4b3 100644
--- a/sound/pci/azt3328.c
+++ b/sound/pci/azt3328.c
@@ -1344,15 +1344,15 @@ static int __devinit snd_azf3328_create(snd_card_t * card,
for (tmp=0; tmp <= 0x01; tmp += 1)
snd_azf3328_dbgmisc("0x%02x: opl 0x%04x, mpu300 0x%04x, mpu310 0x%04x, mpu320 0x%04x, mpu330 0x%04x\n", tmp, inb(0x388 + tmp), inb(0x300 + tmp), inb(0x310 + tmp), inb(0x320 + tmp), inb(0x330 + tmp));
- /* create mixer interface & switches */
- if ((err = snd_azf3328_mixer_new(chip)) < 0)
- return err;
-
if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
snd_azf3328_free(chip);
return err;
}
+ /* create mixer interface & switches */
+ if ((err = snd_azf3328_mixer_new(chip)) < 0)
+ return err;
+
#if 0
/* set very low bitrate to reduce noise and power consumption? */
snd_azf3328_setfmt(chip, IDX_IO_PLAY_SOUNDFORMAT, 5512, 8, 1);
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index df4d04f7c201d5..17fbed0f064193 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -2608,8 +2608,8 @@ static int __devinit snd_cmipci_create(snd_card_t *card, struct pci_dev *pci,
if (request_irq(pci->irq, snd_cmipci_interrupt, SA_INTERRUPT|SA_SHIRQ, card->driver, (void *)cm)) {
snd_printk("unable to grab IRQ %d\n", pci->irq);
- err = -EBUSY;
- goto __error;
+ snd_cmipci_free(cm);
+ return -EBUSY;
}
cm->irq = pci->irq;
@@ -2662,6 +2662,11 @@ static int __devinit snd_cmipci_create(snd_card_t *card, struct pci_dev *pci,
break;
}
+ if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, cm, &ops)) < 0) {
+ snd_cmipci_free(cm);
+ return err;
+ }
+
/* set MPU address */
switch (iomidi) {
case 0x320: val = CM_VMPU_320; break;
@@ -2717,22 +2722,22 @@ static int __devinit snd_cmipci_create(snd_card_t *card, struct pci_dev *pci,
/* create pcm devices */
pcm_index = pcm_spdif_index = 0;
if ((err = snd_cmipci_pcm_new(cm, pcm_index)) < 0)
- goto __error;
+ return err;
pcm_index++;
if (cm->has_dual_dac) {
if ((err = snd_cmipci_pcm2_new(cm, pcm_index)) < 0)
- goto __error;
+ return err;
pcm_index++;
}
if (cm->can_ac3_hw || cm->can_ac3_sw) {
pcm_spdif_index = pcm_index;
if ((err = snd_cmipci_pcm_spdif_new(cm, pcm_index)) < 0)
- goto __error;
+ return err;
}
/* create mixer interface & switches */
if ((err = snd_cmipci_mixer_new(cm, pcm_spdif_index)) < 0)
- goto __error;
+ return err;
if (iomidi > 0) {
if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_CMIPCI,
@@ -2742,10 +2747,6 @@ static int __devinit snd_cmipci_create(snd_card_t *card, struct pci_dev *pci,
}
}
- if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, cm, &ops)) < 0) {
- snd_cmipci_free(cm);
- return err;
- }
#ifdef USE_VAR48KRATE
for (val = 0; val < ARRAY_SIZE(rates); val++)
snd_cmipci_set_pll(cm, rates[val], val);
@@ -2785,10 +2786,6 @@ static int __devinit snd_cmipci_create(snd_card_t *card, struct pci_dev *pci,
*rcmipci = cm;
return 0;
-
- __error:
- snd_cmipci_free(cm);
- return err;
}
/*
diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c
index a34e91524bfee2..72831d064e4062 100644
--- a/sound/pci/cs4281.c
+++ b/sound/pci/cs4281.c
@@ -1439,15 +1439,15 @@ static int __devinit snd_cs4281_create(snd_card_t * card,
return tmp;
}
- snd_cs4281_proc_init(chip);
-
- snd_card_set_pm_callback(card, cs4281_suspend, cs4281_resume, chip);
-
if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
snd_cs4281_free(chip);
return err;
}
+ snd_cs4281_proc_init(chip);
+
+ snd_card_set_pm_callback(card, cs4281_suspend, cs4281_resume, chip);
+
snd_card_set_dev(card, &pci->dev);
*rchip = chip;
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c
index 41a2fe4939d883..0dcfee80159786 100644
--- a/sound/pci/cs46xx/cs46xx_lib.c
+++ b/sound/pci/cs46xx/cs46xx_lib.c
@@ -3909,15 +3909,15 @@ int __devinit snd_cs46xx_create(snd_card_t * card,
return err;
}
- snd_cs46xx_proc_init(card, chip);
-
- snd_card_set_pm_callback(card, snd_cs46xx_suspend, snd_cs46xx_resume, chip);
-
if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
snd_cs46xx_free(chip);
return err;
}
+ snd_cs46xx_proc_init(card, chip);
+
+ snd_card_set_pm_callback(card, snd_cs46xx_suspend, snd_cs46xx_resume, chip);
+
chip->active_ctrl(chip, -1); /* disable CLKRUN */
snd_card_set_dev(card, &pci->dev);
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index d2a9b4c4d620d0..900069b69af9db 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -1924,7 +1924,6 @@ static int __devinit snd_ensoniq_create(snd_card_t * card,
ensoniq->subsystem_vendor_id = cmdw;
pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &cmdw);
ensoniq->subsystem_device_id = cmdw;
- snd_ensoniq_proc_init(ensoniq);
#ifdef CHIP1370
#if 0
ensoniq->ctrl = ES_1370_CDC_EN | ES_1370_SERR_DISABLE | ES_1370_PCLKDIVO(ES_1370_SRTODIV(8000));
@@ -2017,6 +2016,8 @@ static int __devinit snd_ensoniq_create(snd_card_t * card,
return err;
}
+ snd_ensoniq_proc_init(ensoniq);
+
snd_card_set_dev(card, &pci->dev);
*rensoniq = ensoniq;
diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c
index e89b826c675150..4d8b92a0648b41 100644
--- a/sound/pci/korg1212/korg1212.c
+++ b/sound/pci/korg1212/korg1212.c
@@ -2412,14 +2412,17 @@ static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci,
if (rc) K1212_DEBUG_PRINTK("K1212_DEBUG: Reboot Card - RC = %d [%s]\n", rc, stateName[korg1212->cardState]);
#endif
+ if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, korg1212, &ops)) < 0) {
+ snd_korg1212_free(korg1212);
+ return err;
+ }
+
snd_korg1212_EnableCardInterrupts(korg1212);
mdelay(CARD_BOOT_DELAY_IN_MS);
- if (snd_korg1212_downloadDSPCode(korg1212)) {
- snd_korg1212_free(korg1212);
+ if (snd_korg1212_downloadDSPCode(korg1212))
return -EBUSY;
- }
printk(KERN_INFO "dspMemPhy = %08x U[%08x]\n"
"PlayDataPhy = %08x L[%08x]\n"
@@ -2434,10 +2437,8 @@ static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci,
korg1212->RoutingTablePhy, LowerWordSwap(korg1212->RoutingTablePhy),
korg1212->AdatTimeCodePhy, LowerWordSwap(korg1212->AdatTimeCodePhy));
- if ((err = snd_pcm_new(korg1212->card, "korg1212", 0, 1, 1, &korg1212->pcm)) < 0) {
- snd_korg1212_free(korg1212);
+ if ((err = snd_pcm_new(korg1212->card, "korg1212", 0, 1, 1, &korg1212->pcm)) < 0)
return err;
- }
korg1212->pcm->private_data = korg1212;
korg1212->pcm->private_free = snd_korg1212_free_pcm;
@@ -2454,19 +2455,12 @@ static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci,
for (i = 0; i < ARRAY_SIZE(snd_korg1212_controls); i++) {
err = snd_ctl_add(korg1212->card, snd_ctl_new1(&snd_korg1212_controls[i], korg1212));
- if (err < 0) {
- snd_korg1212_free(korg1212);
+ if (err < 0)
return err;
- }
}
snd_korg1212_proc_init(korg1212);
- if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, korg1212, &ops)) < 0) {
- snd_korg1212_free(korg1212);
- return err;
- }
-
snd_card_set_dev(card, &pci->dev);
* rchip = korg1212;
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c
index 1b191022b42a10..87fae627b80168 100644
--- a/sound/pci/maestro3.c
+++ b/sound/pci/maestro3.c
@@ -2564,26 +2564,7 @@ snd_m3_create(snd_card_t *card, struct pci_dev *pci,
snd_m3_assp_init(chip);
snd_m3_amp_enable(chip, 1);
-
- if ((err = snd_m3_mixer(chip)) < 0) {
- snd_m3_free(chip);
- return err;
- }
- for (i = 0; i < chip->num_substreams; i++) {
- m3_dma_t *s = &chip->substreams[i];
- s->chip = chip;
- if ((err = snd_m3_assp_client_init(chip, s, i)) < 0) {
- snd_m3_free(chip);
- return err;
- }
- }
-
- if ((err = snd_m3_pcm(chip, 0)) < 0) {
- snd_m3_free(chip);
- return err;
- }
-
if (request_irq(pci->irq, snd_m3_interrupt, SA_INTERRUPT|SA_SHIRQ,
card->driver, (void *)chip)) {
snd_printk("unable to grab IRQ %d\n", pci->irq);
@@ -2605,6 +2586,19 @@ snd_m3_create(snd_card_t *card, struct pci_dev *pci,
return err;
}
+ if ((err = snd_m3_mixer(chip)) < 0)
+ return err;
+
+ for (i = 0; i < chip->num_substreams; i++) {
+ m3_dma_t *s = &chip->substreams[i];
+ s->chip = chip;
+ if ((err = snd_m3_assp_client_init(chip, s, i)) < 0)
+ return err;
+ }
+
+ if ((err = snd_m3_pcm(chip, 0)) < 0)
+ return err;
+
snd_m3_enable_ints(chip);
snd_m3_assp_continue(chip);
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c
index c38c301bab27fe..33e0d6b52ad9fb 100644
--- a/sound/pci/nm256/nm256.c
+++ b/sound/pci/nm256/nm256.c
@@ -1486,12 +1486,6 @@ snd_nm256_create(snd_card_t *card, struct pci_dev *pci,
snd_nm256_init_chip(chip);
- if ((err = snd_nm256_pcm(chip, 0)) < 0)
- goto __error;
-
- if ((err = snd_nm256_mixer(chip)) < 0)
- goto __error;
-
// pci_set_master(pci); /* needed? */
snd_card_set_pm_callback(card, nm256_suspend, nm256_resume, chip);
@@ -1612,6 +1606,12 @@ static int __devinit snd_nm256_probe(struct pci_dev *pci,
chip->reset_workaround = 1;
}
+ if ((err = snd_nm256_pcm(chip, 0)) < 0 ||
+ (err = snd_nm256_mixer(chip)) < 0) {
+ snd_card_free(card);
+ return err;
+ }
+
sprintf(card->shortname, "NeoMagic %s", card->driver);
sprintf(card->longname, "%s at 0x%lx & 0x%lx, irq %d",
card->shortname,
diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c
index 80d225d7c64060..694a967bad007b 100644
--- a/sound/pci/sonicvibes.c
+++ b/sound/pci/sonicvibes.c
@@ -1333,13 +1333,14 @@ static int __devinit snd_sonicvibes_create(snd_card_t * card,
#endif
sonic->revision = snd_sonicvibes_in(sonic, SV_IREG_REVISION);
snd_ctl_add(card, snd_ctl_new1(&snd_sonicvibes_game_control, sonic));
- snd_sonicvibes_proc_init(sonic);
if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, sonic, &ops)) < 0) {
snd_sonicvibes_free(sonic);
return err;
}
+ snd_sonicvibes_proc_init(sonic);
+
snd_card_set_dev(card, &pci->dev);
*rsonic = sonic;
diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c
index 295626c0441b1b..cafa9abe7e73ab 100644
--- a/sound/pci/trident/trident_main.c
+++ b/sound/pci/trident/trident_main.c
@@ -3614,10 +3614,13 @@ int __devinit snd_trident_create(snd_card_t * card,
return err;
}
- if ((err = snd_trident_mixer(trident, pcm_spdif_device)) < 0) {
+ if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, trident, &ops)) < 0) {
snd_trident_free(trident);
return err;
}
+
+ if ((err = snd_trident_mixer(trident, pcm_spdif_device)) < 0)
+ return err;
/* initialise synth voices */
for (i = 0; i < 64; i++) {
@@ -3638,12 +3641,7 @@ int __devinit snd_trident_create(snd_card_t * card,
snd_card_set_pm_callback(card, snd_trident_suspend, snd_trident_resume, trident);
-
snd_trident_proc_init(trident);
- if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, trident, &ops)) < 0) {
- snd_trident_free(trident);
- return err;
- }
snd_card_set_dev(card, &pci->dev);
*rtrident = trident;
return 0;
@@ -3653,7 +3651,7 @@ int __devinit snd_trident_create(snd_card_t * card,
snd_trident_free
Description: This routine will free the device specific class for
- q the 4DWave card.
+ the 4DWave card.
Paramters: trident - device specific private data for 4DWave card
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
index 30bb04888189ed..4b560a7357b39c 100644
--- a/sound/pci/ymfpci/ymfpci_main.c
+++ b/sound/pci/ymfpci/ymfpci_main.c
@@ -2266,13 +2266,13 @@ int __devinit snd_ymfpci_create(snd_card_t * card,
snd_card_set_pm_callback(card, snd_ymfpci_suspend, snd_ymfpci_resume, chip);
#endif
- snd_ymfpci_proc_init(card, chip);
-
if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
snd_ymfpci_free(chip);
return err;
}
+ snd_ymfpci_proc_init(card, chip);
+
snd_card_set_dev(card, &pci->dev);
*rchip = chip;