summaryrefslogtreecommitdiffstats
path: root/sound/pci/es1938.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/es1938.c')
-rw-r--r--sound/pci/es1938.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c
index 2da988f78ba7..1a8d36df4b5d 100644
--- a/sound/pci/es1938.c
+++ b/sound/pci/es1938.c
@@ -1481,10 +1481,14 @@ static int es1938_suspend(struct pci_dev *pci, pm_message_t state)
*d = snd_es1938_reg_read(chip, *s);
outb(0x00, SLIO_REG(chip, IRQCONTROL)); /* disable irqs */
- if (chip->irq >= 0)
+ if (chip->irq >= 0) {
+ synchronize_irq(chip->irq);
free_irq(chip->irq, chip);
+ chip->irq = -1;
+ }
pci_disable_device(pci);
pci_save_state(pci);
+ pci_set_power_state(pci, pci_choose_state(pci, state));
return 0;
}
@@ -1494,10 +1498,22 @@ static int es1938_resume(struct pci_dev *pci)
struct es1938 *chip = card->private_data;
unsigned char *s, *d;
+ pci_set_power_state(pci, PCI_D0);
pci_restore_state(pci);
- pci_enable_device(pci);
- request_irq(pci->irq, snd_es1938_interrupt,
- IRQF_DISABLED|IRQF_SHARED, "ES1938", chip);
+ if (pci_enable_device(pci) < 0) {
+ printk(KERN_ERR "es1938: pci_enable_device failed, "
+ "disabling device\n");
+ snd_card_disconnect(card);
+ return -EIO;
+ }
+
+ if (request_irq(pci->irq, snd_es1938_interrupt,
+ IRQF_DISABLED|IRQF_SHARED, "ES1938", chip)) {
+ printk(KERN_ERR "es1938: unable to grab IRQ %d, "
+ "disabling device\n", pci->irq);
+ snd_card_disconnect(card);
+ return -EIO;
+ }
chip->irq = pci->irq;
snd_es1938_chip_init(chip);
@@ -1556,8 +1572,10 @@ static int snd_es1938_free(struct es1938 *chip)
snd_es1938_free_gameport(chip);
- if (chip->irq >= 0)
+ if (chip->irq >= 0) {
+ synchronize_irq(chip->irq);
free_irq(chip->irq, chip);
+ }
pci_release_regions(chip->pci);
pci_disable_device(chip->pci);
kfree(chip);
@@ -1602,6 +1620,7 @@ static int __devinit snd_es1938_create(struct snd_card *card,
spin_lock_init(&chip->mixer_lock);
chip->card = card;
chip->pci = pci;
+ chip->irq = -1;
if ((err = pci_request_regions(pci, "ESS Solo-1")) < 0) {
kfree(chip);
pci_disable_device(pci);