diff options
author | Andres Salomon <dilinger@debian.org> | 2007-09-03 09:42:52 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2007-10-16 09:59:53 -0400 |
commit | 1caae3682e2a712b64ce682702ed56bb3dc9f435 (patch) | |
tree | fa2d7a04f358f59e2869df8689edfa464e8cf75c | |
parent | 222fa0b0d2fdb2373a71d532c2cabd2ec920b3b3 (diff) |
[ALSA] cs5535audio: update PCI device handling in suspend/resume
Save the PCI state before disabling the device, and add some error checking.
Signed-off-by: Andres Salomon <dilinger@debian.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
-rw-r--r-- | sound/pci/cs5535audio/cs5535audio_pm.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sound/pci/cs5535audio/cs5535audio_pm.c b/sound/pci/cs5535audio/cs5535audio_pm.c index 9a4e84aa3e04..838708f6d45e 100644 --- a/sound/pci/cs5535audio/cs5535audio_pm.c +++ b/sound/pci/cs5535audio/cs5535audio_pm.c | |||
@@ -74,8 +74,11 @@ int snd_cs5535audio_suspend(struct pci_dev *pci, pm_message_t state) | |||
74 | /* save important regs, then disable aclink in hw */ | 74 | /* save important regs, then disable aclink in hw */ |
75 | snd_cs5535audio_stop_hardware(cs5535au); | 75 | snd_cs5535audio_stop_hardware(cs5535au); |
76 | 76 | ||
77 | if (pci_save_state(pci)) { | ||
78 | printk(KERN_ERR "cs5535audio: pci_save_state failed!\n"); | ||
79 | return -EIO; | ||
80 | } | ||
77 | pci_disable_device(pci); | 81 | pci_disable_device(pci); |
78 | pci_save_state(pci); | ||
79 | pci_set_power_state(pci, pci_choose_state(pci, state)); | 82 | pci_set_power_state(pci, pci_choose_state(pci, state)); |
80 | return 0; | 83 | return 0; |
81 | } | 84 | } |
@@ -89,7 +92,12 @@ int snd_cs5535audio_resume(struct pci_dev *pci) | |||
89 | int i; | 92 | int i; |
90 | 93 | ||
91 | pci_set_power_state(pci, PCI_D0); | 94 | pci_set_power_state(pci, PCI_D0); |
92 | pci_restore_state(pci); | 95 | if (pci_restore_state(pci) < 0) { |
96 | printk(KERN_ERR "cs5535audio: pci_restore_state failed, " | ||
97 | "disabling device\n"); | ||
98 | snd_card_disconnect(card); | ||
99 | return -EIO; | ||
100 | } | ||
93 | if (pci_enable_device(pci) < 0) { | 101 | if (pci_enable_device(pci) < 0) { |
94 | printk(KERN_ERR "cs5535audio: pci_enable_device failed, " | 102 | printk(KERN_ERR "cs5535audio: pci_enable_device failed, " |
95 | "disabling device\n"); | 103 | "disabling device\n"); |