From 30b35399ceb2398d05837863476dcb12f12f3a82 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 11 Oct 2006 18:52:53 +0200 Subject: [ALSA] Various fixes for suspend/resume of ALSA PCI drivers - Check the return value of pci_enable_device() and request_irq() in the suspend. If any error occurs there, disable the device using snd_card_disconnect(). - Call pci_set_power_state() properly with pci_choose_state(). - Fix the order to call pci_set_power_state(). - Removed obsolete house-made PM codes in some drivers. Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- sound/pci/via82xx.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'sound/pci/via82xx.c') diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index e6990e0bbf2..92b0736c0fd 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c @@ -2185,9 +2185,9 @@ static int snd_via82xx_suspend(struct pci_dev *pci, pm_message_t state) chip->capture_src_saved[1] = inb(chip->port + VIA_REG_CAPTURE_CHANNEL + 0x10); } - pci_set_power_state(pci, PCI_D3hot); pci_disable_device(pci); pci_save_state(pci); + pci_set_power_state(pci, pci_choose_state(pci, state)); return 0; } @@ -2197,9 +2197,15 @@ static int snd_via82xx_resume(struct pci_dev *pci) struct via82xx *chip = card->private_data; int i; - pci_restore_state(pci); - pci_enable_device(pci); pci_set_power_state(pci, PCI_D0); + pci_restore_state(pci); + if (pci_enable_device(pci) < 0) { + printk(KERN_ERR "via82xx: pci_enable_device failed, " + "disabling device\n"); + snd_card_disconnect(card); + return -EIO; + } + pci_set_master(pci); snd_via82xx_chip_init(chip); -- cgit v1.2.3-70-g09d2