Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1caae368 authored by Andres Salomon's avatar Andres Salomon Committed by Jaroslav Kysela
Browse files

[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: default avatarAndres Salomon <dilinger@debian.org>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@suse.cz>
parent 222fa0b0
Loading
Loading
Loading
Loading
+10 −2
Original line number Original line Diff line number Diff line
@@ -74,8 +74,11 @@ int snd_cs5535audio_suspend(struct pci_dev *pci, pm_message_t state)
	/* save important regs, then disable aclink in hw */
	/* save important regs, then disable aclink in hw */
	snd_cs5535audio_stop_hardware(cs5535au);
	snd_cs5535audio_stop_hardware(cs5535au);


	if (pci_save_state(pci)) {
		printk(KERN_ERR "cs5535audio: pci_save_state failed!\n");
		return -EIO;
	}
	pci_disable_device(pci);
	pci_disable_device(pci);
	pci_save_state(pci);
	pci_set_power_state(pci, pci_choose_state(pci, state));
	pci_set_power_state(pci, pci_choose_state(pci, state));
	return 0;
	return 0;
}
}
@@ -89,7 +92,12 @@ int snd_cs5535audio_resume(struct pci_dev *pci)
	int i;
	int i;


	pci_set_power_state(pci, PCI_D0);
	pci_set_power_state(pci, PCI_D0);
	pci_restore_state(pci);
	if (pci_restore_state(pci) < 0) {
		printk(KERN_ERR "cs5535audio: pci_restore_state failed, "
		       "disabling device\n");
		snd_card_disconnect(card);
		return -EIO;
	}
	if (pci_enable_device(pci) < 0) {
	if (pci_enable_device(pci) < 0) {
		printk(KERN_ERR "cs5535audio: pci_enable_device failed, "
		printk(KERN_ERR "cs5535audio: pci_enable_device failed, "
		       "disabling device\n");
		       "disabling device\n");