All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/33] Simplify PM callbacks of PCI drivers
@ 2015-01-09 15:52 Takashi Iwai
  2015-01-09 15:52 ` [PATCH 01/33] ALSA: ali5451: Simplify PM callbacks Takashi Iwai
                   ` (32 more replies)
  0 siblings, 33 replies; 35+ messages in thread
From: Takashi Iwai @ 2015-01-09 15:52 UTC (permalink / raw)
  To: alsa-devel

This is a series of patches to get rid of superfluous calls found
in suspend/resume callbacks of PCI drivers.  Just systematically
to each driver code.


Takashi

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 01/33] ALSA: ali5451: Simplify PM callbacks
  2015-01-09 15:52 [PATCH 00/33] Simplify PM callbacks of PCI drivers Takashi Iwai
@ 2015-01-09 15:52 ` Takashi Iwai
  2015-01-09 15:52 ` [PATCH 02/33] ALSA: als300: " Takashi Iwai
                   ` (31 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Takashi Iwai @ 2015-01-09 15:52 UTC (permalink / raw)
  To: alsa-devel

This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801:
PCI core handles power state for us].

Since pci_set_power_state(), pci_save_state() and pci_restore_state()
are already done in the PCI core side, so we don't need to it doubly.

Also, pci_enable_device(), pci_disable_device() and pci_set_master()
calls in PM callbacks are superfluous nowadays, too, so get rid of
them as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/ali5451/ali5451.c | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index af89e42b2160..4cd2210fd95c 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -1873,7 +1873,6 @@ static int snd_ali_mixer(struct snd_ali *codec)
 #ifdef CONFIG_PM_SLEEP
 static int ali_suspend(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct snd_ali *chip = card->private_data;
 	struct snd_ali_image *im;
@@ -1914,16 +1913,11 @@ static int ali_suspend(struct device *dev)
 	outl(0xffffffff, ALI_REG(chip, ALI_STOP));
 
 	spin_unlock_irq(&chip->reg_lock);
-
-	pci_disable_device(pci);
-	pci_save_state(pci);
-	pci_set_power_state(pci, PCI_D3hot);
 	return 0;
 }
 
 static int ali_resume(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct snd_ali *chip = card->private_data;
 	struct snd_ali_image *im;
@@ -1933,15 +1927,6 @@ static int ali_resume(struct device *dev)
 	if (!im)
 		return 0;
 
-	pci_set_power_state(pci, PCI_D0);
-	pci_restore_state(pci);
-	if (pci_enable_device(pci) < 0) {
-		dev_err(dev, "pci_enable_device failed, disabling device\n");
-		snd_card_disconnect(card);
-		return -EIO;
-	}
-	pci_set_master(pci);
-
 	spin_lock_irq(&chip->reg_lock);
 	
 	for (i = 0; i < ALI_CHANNELS; i++) {
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 02/33] ALSA: als300: Simplify PM callbacks
  2015-01-09 15:52 [PATCH 00/33] Simplify PM callbacks of PCI drivers Takashi Iwai
  2015-01-09 15:52 ` [PATCH 01/33] ALSA: ali5451: Simplify PM callbacks Takashi Iwai
@ 2015-01-09 15:52 ` Takashi Iwai
  2015-01-09 15:52 ` [PATCH 03/33] ALSA: als4000: " Takashi Iwai
                   ` (30 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Takashi Iwai @ 2015-01-09 15:52 UTC (permalink / raw)
  To: alsa-devel

This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801:
PCI core handles power state for us].

Since pci_set_power_state(), pci_save_state() and pci_restore_state()
are already done in the PCI core side, so we don't need to it doubly.

Also, pci_enable_device(), pci_disable_device() and pci_set_master()
calls in PM callbacks are superfluous nowadays, too, so get rid of
them as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/als300.c | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/sound/pci/als300.c b/sound/pci/als300.c
index 7bb6ac565107..bd01113de39a 100644
--- a/sound/pci/als300.c
+++ b/sound/pci/als300.c
@@ -728,35 +728,20 @@ static int snd_als300_create(struct snd_card *card,
 #ifdef CONFIG_PM_SLEEP
 static int snd_als300_suspend(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct snd_als300 *chip = card->private_data;
 
 	snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
 	snd_pcm_suspend_all(chip->pcm);
 	snd_ac97_suspend(chip->ac97);
-
-	pci_disable_device(pci);
-	pci_save_state(pci);
-	pci_set_power_state(pci, PCI_D3hot);
 	return 0;
 }
 
 static int snd_als300_resume(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct snd_als300 *chip = card->private_data;
 
-	pci_set_power_state(pci, PCI_D0);
-	pci_restore_state(pci);
-	if (pci_enable_device(pci) < 0) {
-		dev_err(dev, "pci_enable_device failed, disabling device\n");
-		snd_card_disconnect(card);
-		return -EIO;
-	}
-	pci_set_master(pci);
-
 	snd_als300_init(chip);
 	snd_ac97_resume(chip->ac97);
 
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 03/33] ALSA: als4000: Simplify PM callbacks
  2015-01-09 15:52 [PATCH 00/33] Simplify PM callbacks of PCI drivers Takashi Iwai
  2015-01-09 15:52 ` [PATCH 01/33] ALSA: ali5451: Simplify PM callbacks Takashi Iwai
  2015-01-09 15:52 ` [PATCH 02/33] ALSA: als300: " Takashi Iwai
@ 2015-01-09 15:52 ` Takashi Iwai
  2015-01-09 15:52 ` [PATCH 04/33] ALSA: atiixp: " Takashi Iwai
                   ` (29 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Takashi Iwai @ 2015-01-09 15:52 UTC (permalink / raw)
  To: alsa-devel

This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801:
PCI core handles power state for us].

Since pci_set_power_state(), pci_save_state() and pci_restore_state()
are already done in the PCI core side, so we don't need to it doubly.

Also, pci_enable_device(), pci_disable_device() and pci_set_master()
calls in PM callbacks are superfluous nowadays, too, so get rid of
them as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/als4000.c | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c
index d3e6424ee656..94608524f3cc 100644
--- a/sound/pci/als4000.c
+++ b/sound/pci/als4000.c
@@ -988,7 +988,6 @@ static void snd_card_als4000_remove(struct pci_dev *pci)
 #ifdef CONFIG_PM_SLEEP
 static int snd_als4000_suspend(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct snd_card_als4000 *acard = card->private_data;
 	struct snd_sb *chip = acard->chip;
@@ -997,29 +996,15 @@ static int snd_als4000_suspend(struct device *dev)
 	
 	snd_pcm_suspend_all(chip->pcm);
 	snd_sbmixer_suspend(chip);
-
-	pci_disable_device(pci);
-	pci_save_state(pci);
-	pci_set_power_state(pci, PCI_D3hot);
 	return 0;
 }
 
 static int snd_als4000_resume(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct snd_card_als4000 *acard = card->private_data;
 	struct snd_sb *chip = acard->chip;
 
-	pci_set_power_state(pci, PCI_D0);
-	pci_restore_state(pci);
-	if (pci_enable_device(pci) < 0) {
-		dev_err(dev, "pci_enable_device failed, disabling device\n");
-		snd_card_disconnect(card);
-		return -EIO;
-	}
-	pci_set_master(pci);
-
 	snd_als4000_configure(chip);
 	snd_sbdsp_reset(chip);
 	snd_sbmixer_resume(chip);
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 04/33] ALSA: atiixp: Simplify PM callbacks
  2015-01-09 15:52 [PATCH 00/33] Simplify PM callbacks of PCI drivers Takashi Iwai
                   ` (2 preceding siblings ...)
  2015-01-09 15:52 ` [PATCH 03/33] ALSA: als4000: " Takashi Iwai
@ 2015-01-09 15:52 ` Takashi Iwai
  2015-01-09 15:52 ` [PATCH 05/33] ALSA: atiixp-modem: " Takashi Iwai
                   ` (28 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Takashi Iwai @ 2015-01-09 15:52 UTC (permalink / raw)
  To: alsa-devel

This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801:
PCI core handles power state for us].

Since pci_set_power_state(), pci_save_state() and pci_restore_state()
are already done in the PCI core side, so we don't need to it doubly.

Also, pci_enable_device(), pci_disable_device() and pci_set_master()
calls in PM callbacks are superfluous nowadays, too, so get rid of
them as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/atiixp.c | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c
index 9c1c4452a8ee..f41de00d974c 100644
--- a/sound/pci/atiixp.c
+++ b/sound/pci/atiixp.c
@@ -1474,7 +1474,6 @@ static int snd_atiixp_mixer_new(struct atiixp *chip, int clock,
  */
 static int snd_atiixp_suspend(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct atiixp *chip = card->private_data;
 	int i;
@@ -1492,29 +1491,15 @@ static int snd_atiixp_suspend(struct device *dev)
 		snd_ac97_suspend(chip->ac97[i]);
 	snd_atiixp_aclink_down(chip);
 	snd_atiixp_chip_stop(chip);
-
-	pci_disable_device(pci);
-	pci_save_state(pci);
-	pci_set_power_state(pci, PCI_D3hot);
 	return 0;
 }
 
 static int snd_atiixp_resume(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct atiixp *chip = card->private_data;
 	int i;
 
-	pci_set_power_state(pci, PCI_D0);
-	pci_restore_state(pci);
-	if (pci_enable_device(pci) < 0) {
-		dev_err(dev, "pci_enable_device failed, disabling device\n");
-		snd_card_disconnect(card);
-		return -EIO;
-	}
-	pci_set_master(pci);
-
 	snd_atiixp_aclink_reset(chip);
 	snd_atiixp_chip_start(chip);
 
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 05/33] ALSA: atiixp-modem: Simplify PM callbacks
  2015-01-09 15:52 [PATCH 00/33] Simplify PM callbacks of PCI drivers Takashi Iwai
                   ` (3 preceding siblings ...)
  2015-01-09 15:52 ` [PATCH 04/33] ALSA: atiixp: " Takashi Iwai
@ 2015-01-09 15:52 ` Takashi Iwai
  2015-01-09 15:52 ` [PATCH 06/33] ALSA: azt3328: " Takashi Iwai
                   ` (27 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Takashi Iwai @ 2015-01-09 15:52 UTC (permalink / raw)
  To: alsa-devel

This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801:
PCI core handles power state for us].

Since pci_set_power_state(), pci_save_state() and pci_restore_state()
are already done in the PCI core side, so we don't need to it doubly.

Also, pci_enable_device(), pci_disable_device() and pci_set_master()
calls in PM callbacks are superfluous nowadays, too, so get rid of
them as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/atiixp_modem.c | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c
index b2f63e0727de..7cf419786b6e 100644
--- a/sound/pci/atiixp_modem.c
+++ b/sound/pci/atiixp_modem.c
@@ -1120,7 +1120,6 @@ static int snd_atiixp_mixer_new(struct atiixp_modem *chip, int clock)
  */
 static int snd_atiixp_suspend(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct atiixp_modem *chip = card->private_data;
 	int i;
@@ -1132,29 +1131,15 @@ static int snd_atiixp_suspend(struct device *dev)
 		snd_ac97_suspend(chip->ac97[i]);
 	snd_atiixp_aclink_down(chip);
 	snd_atiixp_chip_stop(chip);
-
-	pci_disable_device(pci);
-	pci_save_state(pci);
-	pci_set_power_state(pci, PCI_D3hot);
 	return 0;
 }
 
 static int snd_atiixp_resume(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct atiixp_modem *chip = card->private_data;
 	int i;
 
-	pci_set_power_state(pci, PCI_D0);
-	pci_restore_state(pci);
-	if (pci_enable_device(pci) < 0) {
-		dev_err(dev, "pci_enable_device failed, disabling device\n");
-		snd_card_disconnect(card);
-		return -EIO;
-	}
-	pci_set_master(pci);
-
 	snd_atiixp_aclink_reset(chip);
 	snd_atiixp_chip_start(chip);
 
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 06/33] ALSA: azt3328: Simplify PM callbacks
  2015-01-09 15:52 [PATCH 00/33] Simplify PM callbacks of PCI drivers Takashi Iwai
                   ` (4 preceding siblings ...)
  2015-01-09 15:52 ` [PATCH 05/33] ALSA: atiixp-modem: " Takashi Iwai
@ 2015-01-09 15:52 ` Takashi Iwai
  2015-01-09 15:52 ` [PATCH 07/33] ALSA: ca0106: " Takashi Iwai
                   ` (26 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Takashi Iwai @ 2015-01-09 15:52 UTC (permalink / raw)
  To: alsa-devel

This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801:
PCI core handles power state for us].

Since pci_set_power_state(), pci_save_state() and pci_restore_state()
are already done in the PCI core side, so we don't need to it doubly.

Also, pci_enable_device(), pci_disable_device() and pci_set_master()
calls in PM callbacks are superfluous nowadays, too, so get rid of
them as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/azt3328.c | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c
index fdbb9c05c77b..bbacc75c902a 100644
--- a/sound/pci/azt3328.c
+++ b/sound/pci/azt3328.c
@@ -2694,7 +2694,6 @@ snd_azf3328_resume_ac97(const struct snd_azf3328 *chip)
 static int
 snd_azf3328_suspend(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct snd_azf3328 *chip = card->private_data;
 	u16 *saved_regs_ctrl_u16;
@@ -2720,29 +2719,15 @@ snd_azf3328_suspend(struct device *dev)
 		ARRAY_SIZE(chip->saved_regs_mpu), chip->saved_regs_mpu);
 	snd_azf3328_suspend_regs(chip, chip->opl3_io,
 		ARRAY_SIZE(chip->saved_regs_opl3), chip->saved_regs_opl3);
-
-	pci_disable_device(pci);
-	pci_save_state(pci);
-	pci_set_power_state(pci, PCI_D3hot);
 	return 0;
 }
 
 static int
 snd_azf3328_resume(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	const struct snd_azf3328 *chip = card->private_data;
 
-	pci_set_power_state(pci, PCI_D0);
-	pci_restore_state(pci);
-	if (pci_enable_device(pci) < 0) {
-		dev_err(dev, "pci_enable_device failed, disabling device\n");
-		snd_card_disconnect(card);
-		return -EIO;
-	}
-	pci_set_master(pci);
-
 	snd_azf3328_resume_regs(chip, chip->saved_regs_game, chip->game_io,
 					ARRAY_SIZE(chip->saved_regs_game));
 	snd_azf3328_resume_regs(chip, chip->saved_regs_mpu, chip->mpu_io,
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 07/33] ALSA: ca0106: Simplify PM callbacks
  2015-01-09 15:52 [PATCH 00/33] Simplify PM callbacks of PCI drivers Takashi Iwai
                   ` (5 preceding siblings ...)
  2015-01-09 15:52 ` [PATCH 06/33] ALSA: azt3328: " Takashi Iwai
@ 2015-01-09 15:52 ` Takashi Iwai
  2015-01-09 15:52 ` [PATCH 08/33] ALSA: cmipci: " Takashi Iwai
                   ` (25 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Takashi Iwai @ 2015-01-09 15:52 UTC (permalink / raw)
  To: alsa-devel

This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801:
PCI core handles power state for us].

Since pci_set_power_state(), pci_save_state() and pci_restore_state()
are already done in the PCI core side, so we don't need to it doubly.

Also, pci_enable_device(), pci_disable_device() and pci_set_master()
calls in PM callbacks are superfluous nowadays, too, so get rid of
them as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/ca0106/ca0106_main.c | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c
index 96af33965b51..dd75b7536fa2 100644
--- a/sound/pci/ca0106/ca0106_main.c
+++ b/sound/pci/ca0106/ca0106_main.c
@@ -1910,7 +1910,6 @@ static void snd_ca0106_remove(struct pci_dev *pci)
 #ifdef CONFIG_PM_SLEEP
 static int snd_ca0106_suspend(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct snd_ca0106 *chip = card->private_data;
 	int i;
@@ -1923,30 +1922,15 @@ static int snd_ca0106_suspend(struct device *dev)
 	snd_ca0106_mixer_suspend(chip);
 
 	ca0106_stop_chip(chip);
-
-	pci_disable_device(pci);
-	pci_save_state(pci);
-	pci_set_power_state(pci, PCI_D3hot);
 	return 0;
 }
 
 static int snd_ca0106_resume(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct snd_ca0106 *chip = card->private_data;
 	int i;
 
-	pci_set_power_state(pci, PCI_D0);
-	pci_restore_state(pci);
-
-	if (pci_enable_device(pci) < 0) {
-		snd_card_disconnect(card);
-		return -EIO;
-	}
-
-	pci_set_master(pci);
-
 	ca0106_init_chip(chip, 1);
 
 	if (chip->details->ac97)
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 08/33] ALSA: cmipci: Simplify PM callbacks
  2015-01-09 15:52 [PATCH 00/33] Simplify PM callbacks of PCI drivers Takashi Iwai
                   ` (6 preceding siblings ...)
  2015-01-09 15:52 ` [PATCH 07/33] ALSA: ca0106: " Takashi Iwai
@ 2015-01-09 15:52 ` Takashi Iwai
  2015-01-09 15:52 ` [PATCH 09/33] ALSA: cs4281: " Takashi Iwai
                   ` (24 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Takashi Iwai @ 2015-01-09 15:52 UTC (permalink / raw)
  To: alsa-devel

This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801:
PCI core handles power state for us].

Since pci_set_power_state(), pci_save_state() and pci_restore_state()
are already done in the PCI core side, so we don't need to it doubly.

Also, pci_enable_device(), pci_disable_device() and pci_set_master()
calls in PM callbacks are superfluous nowadays, too, so get rid of
them as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/cmipci.c | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index 85ed40339db9..63d2c8236ec6 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -3347,7 +3347,6 @@ static unsigned char saved_mixers[] = {
 
 static int snd_cmipci_suspend(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct cmipci *cm = card->private_data;
 	int i;
@@ -3366,29 +3365,15 @@ static int snd_cmipci_suspend(struct device *dev)
 
 	/* disable ints */
 	snd_cmipci_write(cm, CM_REG_INT_HLDCLR, 0);
-
-	pci_disable_device(pci);
-	pci_save_state(pci);
-	pci_set_power_state(pci, PCI_D3hot);
 	return 0;
 }
 
 static int snd_cmipci_resume(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct cmipci *cm = card->private_data;
 	int i;
 
-	pci_set_power_state(pci, PCI_D0);
-	pci_restore_state(pci);
-	if (pci_enable_device(pci) < 0) {
-		dev_err(dev, "pci_enable_device failed, disabling device\n");
-		snd_card_disconnect(card);
-		return -EIO;
-	}
-	pci_set_master(pci);
-
 	/* reset / initialize to a sane state */
 	snd_cmipci_write(cm, CM_REG_INT_HLDCLR, 0);
 	snd_cmipci_ch_reset(cm, CM_CH_PLAY);
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 09/33] ALSA: cs4281: Simplify PM callbacks
  2015-01-09 15:52 [PATCH 00/33] Simplify PM callbacks of PCI drivers Takashi Iwai
                   ` (7 preceding siblings ...)
  2015-01-09 15:52 ` [PATCH 08/33] ALSA: cmipci: " Takashi Iwai
@ 2015-01-09 15:52 ` Takashi Iwai
  2015-01-09 15:52 ` [PATCH 10/33] ALSA: cs46xx: " Takashi Iwai
                   ` (23 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Takashi Iwai @ 2015-01-09 15:52 UTC (permalink / raw)
  To: alsa-devel

This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801:
PCI core handles power state for us].

Since pci_set_power_state(), pci_save_state() and pci_restore_state()
are already done in the PCI core side, so we don't need to it doubly.

Also, pci_enable_device(), pci_disable_device() and pci_set_master()
calls in PM callbacks are superfluous nowadays, too, so get rid of
them as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/cs4281.c | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c
index 4c49b5c8a7b3..80bb1d11da12 100644
--- a/sound/pci/cs4281.c
+++ b/sound/pci/cs4281.c
@@ -2008,7 +2008,6 @@ static int saved_regs[SUSPEND_REGISTERS] = {
 
 static int cs4281_suspend(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct cs4281 *chip = card->private_data;
 	u32 ulCLK;
@@ -2047,30 +2046,16 @@ static int cs4281_suspend(struct device *dev)
 	ulCLK = snd_cs4281_peekBA0(chip, BA0_CLKCR1);
 	ulCLK &= ~CLKCR1_CKRA;
 	snd_cs4281_pokeBA0(chip, BA0_CLKCR1, ulCLK);
-
-	pci_disable_device(pci);
-	pci_save_state(pci);
-	pci_set_power_state(pci, PCI_D3hot);
 	return 0;
 }
 
 static int cs4281_resume(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct cs4281 *chip = card->private_data;
 	unsigned int i;
 	u32 ulCLK;
 
-	pci_set_power_state(pci, PCI_D0);
-	pci_restore_state(pci);
-	if (pci_enable_device(pci) < 0) {
-		dev_err(dev, "pci_enable_device failed, disabling device\n");
-		snd_card_disconnect(card);
-		return -EIO;
-	}
-	pci_set_master(pci);
-
 	ulCLK = snd_cs4281_peekBA0(chip, BA0_CLKCR1);
 	ulCLK |= CLKCR1_CKRA;
 	snd_cs4281_pokeBA0(chip, BA0_CLKCR1, ulCLK);
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 10/33] ALSA: cs46xx: Simplify PM callbacks
  2015-01-09 15:52 [PATCH 00/33] Simplify PM callbacks of PCI drivers Takashi Iwai
                   ` (8 preceding siblings ...)
  2015-01-09 15:52 ` [PATCH 09/33] ALSA: cs4281: " Takashi Iwai
@ 2015-01-09 15:52 ` Takashi Iwai
  2015-01-09 15:52 ` [PATCH 11/33] ALSA: cs5535audio: " Takashi Iwai
                   ` (22 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Takashi Iwai @ 2015-01-09 15:52 UTC (permalink / raw)
  To: alsa-devel

This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801:
PCI core handles power state for us].

Since pci_set_power_state(), pci_save_state() and pci_restore_state()
are already done in the PCI core side, so we don't need to it doubly.

Also, pci_enable_device(), pci_disable_device() and pci_set_master()
calls in PM callbacks are superfluous nowadays, too, so get rid of
them as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/cs46xx/cs46xx_lib.c | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c
index 32b44f25b5c8..ba97aba8d87e 100644
--- a/sound/pci/cs46xx/cs46xx_lib.c
+++ b/sound/pci/cs46xx/cs46xx_lib.c
@@ -3804,7 +3804,6 @@ static unsigned int saved_regs[] = {
 
 static int snd_cs46xx_suspend(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct snd_cs46xx *chip = card->private_data;
 	int i, amp_saved;
@@ -3829,16 +3828,11 @@ static int snd_cs46xx_suspend(struct device *dev)
 	/* disable CLKRUN */
 	chip->active_ctrl(chip, -chip->amplifier);
 	chip->amplifier = amp_saved; /* restore the status */
-
-	pci_disable_device(pci);
-	pci_save_state(pci);
-	pci_set_power_state(pci, PCI_D3hot);
 	return 0;
 }
 
 static int snd_cs46xx_resume(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct snd_cs46xx *chip = card->private_data;
 	int amp_saved;
@@ -3847,15 +3841,6 @@ static int snd_cs46xx_resume(struct device *dev)
 #endif
 	unsigned int tmp;
 
-	pci_set_power_state(pci, PCI_D0);
-	pci_restore_state(pci);
-	if (pci_enable_device(pci) < 0) {
-		dev_err(dev, "pci_enable_device failed, disabling device\n");
-		snd_card_disconnect(card);
-		return -EIO;
-	}
-	pci_set_master(pci);
-
 	amp_saved = chip->amplifier;
 	chip->amplifier = 0;
 	chip->active_ctrl(chip, 1); /* force to on */
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 11/33] ALSA: cs5535audio: Simplify PM callbacks
  2015-01-09 15:52 [PATCH 00/33] Simplify PM callbacks of PCI drivers Takashi Iwai
                   ` (9 preceding siblings ...)
  2015-01-09 15:52 ` [PATCH 10/33] ALSA: cs46xx: " Takashi Iwai
@ 2015-01-09 15:52 ` Takashi Iwai
  2015-01-09 15:52 ` [PATCH 12/33] ALSA: ctxfi: " Takashi Iwai
                   ` (21 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Takashi Iwai @ 2015-01-09 15:52 UTC (permalink / raw)
  To: alsa-devel

This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801:
PCI core handles power state for us].

Since pci_set_power_state(), pci_save_state() and pci_restore_state()
are already done in the PCI core side, so we don't need to it doubly.

Also, pci_enable_device(), pci_disable_device() and pci_set_master()
calls in PM callbacks are superfluous nowadays, too, so get rid of
them as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/cs5535audio/cs5535audio_pm.c | 18 ------------------
 1 file changed, 18 deletions(-)

diff --git a/sound/pci/cs5535audio/cs5535audio_pm.c b/sound/pci/cs5535audio/cs5535audio_pm.c
index 34cc60057d0c..06ac5d8da362 100644
--- a/sound/pci/cs5535audio/cs5535audio_pm.c
+++ b/sound/pci/cs5535audio/cs5535audio_pm.c
@@ -57,7 +57,6 @@ static void snd_cs5535audio_stop_hardware(struct cs5535audio *cs5535au)
 
 static int snd_cs5535audio_suspend(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct cs5535audio *cs5535au = card->private_data;
 	int i;
@@ -72,34 +71,17 @@ static int snd_cs5535audio_suspend(struct device *dev)
 	}
 	/* save important regs, then disable aclink in hw */
 	snd_cs5535audio_stop_hardware(cs5535au);
-
-	if (pci_save_state(pci)) {
-		dev_err(dev, "pci_save_state failed!\n");
-		return -EIO;
-	}
-	pci_disable_device(pci);
-	pci_set_power_state(pci, PCI_D3hot);
 	return 0;
 }
 
 static int snd_cs5535audio_resume(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct cs5535audio *cs5535au = card->private_data;
 	u32 tmp;
 	int timeout;
 	int i;
 
-	pci_set_power_state(pci, PCI_D0);
-	pci_restore_state(pci);
-	if (pci_enable_device(pci) < 0) {
-		dev_err(dev, "pci_enable_device failed, disabling device\n");
-		snd_card_disconnect(card);
-		return -EIO;
-	}
-	pci_set_master(pci);
-
 	/* set LNK_WRM_RST to reset AC link */
 	cs_writel(cs5535au, ACC_CODEC_CNTL, ACC_CODEC_CNTL_LNK_WRM_RST);
 
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 12/33] ALSA: ctxfi: Simplify PM callbacks
  2015-01-09 15:52 [PATCH 00/33] Simplify PM callbacks of PCI drivers Takashi Iwai
                   ` (10 preceding siblings ...)
  2015-01-09 15:52 ` [PATCH 11/33] ALSA: cs5535audio: " Takashi Iwai
@ 2015-01-09 15:52 ` Takashi Iwai
  2015-01-09 15:52 ` [PATCH 13/33] ALSA: echoaudio: " Takashi Iwai
                   ` (20 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Takashi Iwai @ 2015-01-09 15:52 UTC (permalink / raw)
  To: alsa-devel

This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801:
PCI core handles power state for us].

Since pci_set_power_state(), pci_save_state() and pci_restore_state()
are already done in the PCI core side, so we don't need to it doubly.

Also, pci_enable_device(), pci_disable_device() and pci_set_master()
calls in PM callbacks are superfluous nowadays, too, so get rid of
them as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/ctxfi/cthw20k1.c |  9 ---------
 sound/pci/ctxfi/cthw20k2.c | 12 ------------
 2 files changed, 21 deletions(-)

diff --git a/sound/pci/ctxfi/cthw20k1.c b/sound/pci/ctxfi/cthw20k1.c
index b425aa8ee578..f16bec129c0a 100644
--- a/sound/pci/ctxfi/cthw20k1.c
+++ b/sound/pci/ctxfi/cthw20k1.c
@@ -2099,20 +2099,11 @@ static int hw_suspend(struct hw *hw)
 		pci_write_config_dword(pci, UAA_CFG_SPACE_FLAG, 0x0);
 	}
 
-	pci_disable_device(pci);
-	pci_save_state(pci);
-	pci_set_power_state(pci, PCI_D3hot);
-
 	return 0;
 }
 
 static int hw_resume(struct hw *hw, struct card_conf *info)
 {
-	struct pci_dev *pci = hw->pci;
-
-	pci_set_power_state(pci, PCI_D0);
-	pci_restore_state(pci);
-
 	/* Re-initialize card hardware. */
 	return hw_card_init(hw, info);
 }
diff --git a/sound/pci/ctxfi/cthw20k2.c b/sound/pci/ctxfi/cthw20k2.c
index 253899d13790..613671d330b1 100644
--- a/sound/pci/ctxfi/cthw20k2.c
+++ b/sound/pci/ctxfi/cthw20k2.c
@@ -2209,24 +2209,12 @@ static int hw_card_init(struct hw *hw, struct card_conf *info)
 #ifdef CONFIG_PM_SLEEP
 static int hw_suspend(struct hw *hw)
 {
-	struct pci_dev *pci = hw->pci;
-
 	hw_card_stop(hw);
-
-	pci_disable_device(pci);
-	pci_save_state(pci);
-	pci_set_power_state(pci, PCI_D3hot);
-
 	return 0;
 }
 
 static int hw_resume(struct hw *hw, struct card_conf *info)
 {
-	struct pci_dev *pci = hw->pci;
-
-	pci_set_power_state(pci, PCI_D0);
-	pci_restore_state(pci);
-
 	/* Re-initialize card hardware. */
 	return hw_card_init(hw, info);
 }
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 13/33] ALSA: echoaudio: Simplify PM callbacks
  2015-01-09 15:52 [PATCH 00/33] Simplify PM callbacks of PCI drivers Takashi Iwai
                   ` (11 preceding siblings ...)
  2015-01-09 15:52 ` [PATCH 12/33] ALSA: ctxfi: " Takashi Iwai
@ 2015-01-09 15:52 ` Takashi Iwai
  2015-01-09 15:52 ` [PATCH 14/33] ALSA: emu10k1: " Takashi Iwai
                   ` (19 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Takashi Iwai @ 2015-01-09 15:52 UTC (permalink / raw)
  To: alsa-devel

This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801:
PCI core handles power state for us].

Since pci_set_power_state(), pci_save_state() and pci_restore_state()
are already done in the PCI core side, so we don't need to it doubly.

Also, pci_enable_device(), pci_disable_device() and pci_set_master()
calls in PM callbacks are superfluous nowadays, too, so get rid of
them as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/echoaudio/echoaudio.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c
index 21228adaa70c..58960841ae7c 100644
--- a/sound/pci/echoaudio/echoaudio.c
+++ b/sound/pci/echoaudio/echoaudio.c
@@ -2162,7 +2162,6 @@ ctl_error:
 
 static int snd_echo_suspend(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct echoaudio *chip = dev_get_drvdata(dev);
 
 	snd_pcm_suspend_all(chip->analog_pcm);
@@ -2188,9 +2187,6 @@ static int snd_echo_suspend(struct device *dev)
 	chip->dsp_code = NULL;
 	free_irq(chip->irq, chip);
 	chip->irq = -1;
-	pci_save_state(pci);
-	pci_disable_device(pci);
-
 	return 0;
 }
 
@@ -2204,7 +2200,6 @@ static int snd_echo_resume(struct device *dev)
 	u32 pipe_alloc_mask;
 	int err;
 
-	pci_restore_state(pci);
 	commpage_bak = kmalloc(sizeof(struct echoaudio), GFP_KERNEL);
 	if (commpage_bak == NULL)
 		return -ENOMEM;
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 14/33] ALSA: emu10k1: Simplify PM callbacks
  2015-01-09 15:52 [PATCH 00/33] Simplify PM callbacks of PCI drivers Takashi Iwai
                   ` (12 preceding siblings ...)
  2015-01-09 15:52 ` [PATCH 13/33] ALSA: echoaudio: " Takashi Iwai
@ 2015-01-09 15:52 ` Takashi Iwai
  2015-01-09 15:52 ` [PATCH 15/33] ALSA: ens137x: " Takashi Iwai
                   ` (18 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Takashi Iwai @ 2015-01-09 15:52 UTC (permalink / raw)
  To: alsa-devel

This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801:
PCI core handles power state for us].

Since pci_set_power_state(), pci_save_state() and pci_restore_state()
are already done in the PCI core side, so we don't need to it doubly.

Also, pci_enable_device(), pci_disable_device() and pci_set_master()
calls in PM callbacks are superfluous nowadays, too, so get rid of
them as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/emu10k1/emu10k1.c | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c
index 4c171636efcd..1d262ba2a44a 100644
--- a/sound/pci/emu10k1/emu10k1.c
+++ b/sound/pci/emu10k1/emu10k1.c
@@ -210,7 +210,6 @@ static void snd_card_emu10k1_remove(struct pci_dev *pci)
 #ifdef CONFIG_PM_SLEEP
 static int snd_emu10k1_suspend(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct snd_emu10k1 *emu = card->private_data;
 
@@ -232,28 +231,14 @@ static int snd_emu10k1_suspend(struct device *dev)
 		snd_p16v_suspend(emu);
 
 	snd_emu10k1_done(emu);
-
-	pci_disable_device(pci);
-	pci_save_state(pci);
-	pci_set_power_state(pci, PCI_D3hot);
 	return 0;
 }
 
 static int snd_emu10k1_resume(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct snd_emu10k1 *emu = card->private_data;
 
-	pci_set_power_state(pci, PCI_D0);
-	pci_restore_state(pci);
-	if (pci_enable_device(pci) < 0) {
-		dev_err(dev, "pci_enable_device failed, disabling device\n");
-		snd_card_disconnect(card);
-		return -EIO;
-	}
-	pci_set_master(pci);
-
 	snd_emu10k1_resume_init(emu);
 	snd_emu10k1_efx_resume(emu);
 	snd_ac97_resume(emu->ac97);
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 15/33] ALSA: ens137x: Simplify PM callbacks
  2015-01-09 15:52 [PATCH 00/33] Simplify PM callbacks of PCI drivers Takashi Iwai
                   ` (13 preceding siblings ...)
  2015-01-09 15:52 ` [PATCH 14/33] ALSA: emu10k1: " Takashi Iwai
@ 2015-01-09 15:52 ` Takashi Iwai
  2015-01-09 15:52 ` [PATCH 16/33] ALSA: es1938: " Takashi Iwai
                   ` (17 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Takashi Iwai @ 2015-01-09 15:52 UTC (permalink / raw)
  To: alsa-devel

This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801:
PCI core handles power state for us].

Since pci_set_power_state(), pci_save_state() and pci_restore_state()
are already done in the PCI core side, so we don't need to it doubly.

Also, pci_enable_device(), pci_disable_device() and pci_set_master()
calls in PM callbacks are superfluous nowadays, too, so get rid of
them as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/ens1370.c | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index d94cb3ca7a64..1badd91f6283 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -2049,7 +2049,6 @@ static void snd_ensoniq_chip_init(struct ensoniq *ensoniq)
 #ifdef CONFIG_PM_SLEEP
 static int snd_ensoniq_suspend(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct ensoniq *ensoniq = card->private_data;
 	
@@ -2070,28 +2069,14 @@ static int snd_ensoniq_suspend(struct device *dev)
 	udelay(100);
 	snd_ak4531_suspend(ensoniq->u.es1370.ak4531);
 #endif	
-
-	pci_disable_device(pci);
-	pci_save_state(pci);
-	pci_set_power_state(pci, PCI_D3hot);
 	return 0;
 }
 
 static int snd_ensoniq_resume(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct ensoniq *ensoniq = card->private_data;
 
-	pci_set_power_state(pci, PCI_D0);
-	pci_restore_state(pci);
-	if (pci_enable_device(pci) < 0) {
-		dev_err(dev, "pci_enable_device failed, disabling device\n");
-		snd_card_disconnect(card);
-		return -EIO;
-	}
-	pci_set_master(pci);
-
 	snd_ensoniq_chip_init(ensoniq);
 
 #ifdef CHIP1371	
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 16/33] ALSA: es1938: Simplify PM callbacks
  2015-01-09 15:52 [PATCH 00/33] Simplify PM callbacks of PCI drivers Takashi Iwai
                   ` (14 preceding siblings ...)
  2015-01-09 15:52 ` [PATCH 15/33] ALSA: ens137x: " Takashi Iwai
@ 2015-01-09 15:52 ` Takashi Iwai
  2015-01-09 15:53 ` [PATCH 17/33] ALSA: es1968: " Takashi Iwai
                   ` (16 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Takashi Iwai @ 2015-01-09 15:52 UTC (permalink / raw)
  To: alsa-devel

This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801:
PCI core handles power state for us].

Since pci_set_power_state(), pci_save_state() and pci_restore_state()
are already done in the PCI core side, so we don't need to it doubly.

Also, pci_enable_device(), pci_disable_device() and pci_set_master()
calls in PM callbacks are superfluous nowadays, too, so get rid of
them as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/es1938.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c
index 0fc46eb4e251..a01454b545a0 100644
--- a/sound/pci/es1938.c
+++ b/sound/pci/es1938.c
@@ -1454,7 +1454,6 @@ static unsigned char saved_regs[SAVED_REG_SIZE+1] = {
 
 static int es1938_suspend(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct es1938 *chip = card->private_data;
 	unsigned char *s, *d;
@@ -1471,9 +1470,6 @@ static int es1938_suspend(struct device *dev)
 		free_irq(chip->irq, chip);
 		chip->irq = -1;
 	}
-	pci_disable_device(pci);
-	pci_save_state(pci);
-	pci_set_power_state(pci, PCI_D3hot);
 	return 0;
 }
 
@@ -1484,14 +1480,6 @@ static int es1938_resume(struct device *dev)
 	struct es1938 *chip = card->private_data;
 	unsigned char *s, *d;
 
-	pci_set_power_state(pci, PCI_D0);
-	pci_restore_state(pci);
-	if (pci_enable_device(pci) < 0) {
-		dev_err(dev, "pci_enable_device failed, disabling device\n");
-		snd_card_disconnect(card);
-		return -EIO;
-	}
-
 	if (request_irq(pci->irq, snd_es1938_interrupt,
 			IRQF_SHARED, KBUILD_MODNAME, chip)) {
 		dev_err(dev, "unable to grab IRQ %d, disabling device\n",
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 17/33] ALSA: es1968: Simplify PM callbacks
  2015-01-09 15:52 [PATCH 00/33] Simplify PM callbacks of PCI drivers Takashi Iwai
                   ` (15 preceding siblings ...)
  2015-01-09 15:52 ` [PATCH 16/33] ALSA: es1938: " Takashi Iwai
@ 2015-01-09 15:53 ` Takashi Iwai
  2015-01-09 15:53 ` [PATCH 18/33] ALSA: hda: " Takashi Iwai
                   ` (15 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Takashi Iwai @ 2015-01-09 15:53 UTC (permalink / raw)
  To: alsa-devel

This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801:
PCI core handles power state for us].

Since pci_set_power_state(), pci_save_state() and pci_restore_state()
are already done in the PCI core side, so we don't need to it doubly.

Also, pci_enable_device(), pci_disable_device() and pci_set_master()
calls in PM callbacks are superfluous nowadays, too, so get rid of
them as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/es1968.c | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
index 6039700f8579..631be029f8c0 100644
--- a/sound/pci/es1968.c
+++ b/sound/pci/es1968.c
@@ -2383,7 +2383,6 @@ static void snd_es1968_start_irq(struct es1968 *chip)
  */
 static int es1968_suspend(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct es1968 *chip = card->private_data;
 
@@ -2396,16 +2395,11 @@ static int es1968_suspend(struct device *dev)
 	snd_pcm_suspend_all(chip->pcm);
 	snd_ac97_suspend(chip->ac97);
 	snd_es1968_bob_stop(chip);
-
-	pci_disable_device(pci);
-	pci_save_state(pci);
-	pci_set_power_state(pci, PCI_D3hot);
 	return 0;
 }
 
 static int es1968_resume(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct es1968 *chip = card->private_data;
 	struct esschan *es;
@@ -2413,16 +2407,6 @@ static int es1968_resume(struct device *dev)
 	if (! chip->do_pm)
 		return 0;
 
-	/* restore all our config */
-	pci_set_power_state(pci, PCI_D0);
-	pci_restore_state(pci);
-	if (pci_enable_device(pci) < 0) {
-		dev_err(dev, "pci_enable_device failed, disabling device\n");
-		snd_card_disconnect(card);
-		return -EIO;
-	}
-	pci_set_master(pci);
-
 	snd_es1968_chip_init(chip);
 
 	/* need to restore the base pointers.. */ 
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 18/33] ALSA: hda: Simplify PM callbacks
  2015-01-09 15:52 [PATCH 00/33] Simplify PM callbacks of PCI drivers Takashi Iwai
                   ` (16 preceding siblings ...)
  2015-01-09 15:53 ` [PATCH 17/33] ALSA: es1968: " Takashi Iwai
@ 2015-01-09 15:53 ` Takashi Iwai
  2015-01-09 15:53 ` [PATCH 19/33] ALSA: ice1712: " Takashi Iwai
                   ` (14 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Takashi Iwai @ 2015-01-09 15:53 UTC (permalink / raw)
  To: alsa-devel

This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801:
PCI core handles power state for us].

Since pci_set_power_state(), pci_save_state() and pci_restore_state()
are already done in the PCI core side, so we don't need to it doubly.

Also, pci_enable_device(), pci_disable_device() and pci_set_master()
calls in PM callbacks are superfluous nowadays, too, so get rid of
them as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/hda_intel.c | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index d426a0bd6a5f..99ae4e0d9c07 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -795,7 +795,6 @@ static int param_set_xint(const char *val, const struct kernel_param *kp)
  */
 static int azx_suspend(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct azx *chip;
 	struct hda_intel *hda;
@@ -824,9 +823,6 @@ static int azx_suspend(struct device *dev)
 
 	if (chip->msi)
 		pci_disable_msi(chip->pci);
-	pci_disable_device(pci);
-	pci_save_state(pci);
-	pci_set_power_state(pci, PCI_D3hot);
 	if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL)
 		hda_display_power(false);
 	return 0;
@@ -851,15 +847,6 @@ static int azx_resume(struct device *dev)
 		hda_display_power(true);
 		haswell_set_bclk(chip);
 	}
-	pci_set_power_state(pci, PCI_D0);
-	pci_restore_state(pci);
-	if (pci_enable_device(pci) < 0) {
-		dev_err(chip->card->dev,
-			"pci_enable_device failed, disabling device\n");
-		snd_card_disconnect(card);
-		return -EIO;
-	}
-	pci_set_master(pci);
 	if (chip->msi)
 		if (pci_enable_msi(pci) < 0)
 			chip->msi = 0;
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 19/33] ALSA: ice1712: Simplify PM callbacks
  2015-01-09 15:52 [PATCH 00/33] Simplify PM callbacks of PCI drivers Takashi Iwai
                   ` (17 preceding siblings ...)
  2015-01-09 15:53 ` [PATCH 18/33] ALSA: hda: " Takashi Iwai
@ 2015-01-09 15:53 ` Takashi Iwai
  2015-01-09 15:53 ` [PATCH 20/33] ALSA: ice1724: " Takashi Iwai
                   ` (13 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Takashi Iwai @ 2015-01-09 15:53 UTC (permalink / raw)
  To: alsa-devel

This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801:
PCI core handles power state for us].

Since pci_set_power_state(), pci_save_state() and pci_restore_state()
are already done in the PCI core side, so we don't need to it doubly.

Also, pci_enable_device(), pci_disable_device() and pci_set_master()
calls in PM callbacks are superfluous nowadays, too, so get rid of
them as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/ice1712/ice1712.c | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
index b039b46152c6..e1560bf0d26a 100644
--- a/sound/pci/ice1712/ice1712.c
+++ b/sound/pci/ice1712/ice1712.c
@@ -2798,7 +2798,6 @@ static void snd_ice1712_remove(struct pci_dev *pci)
 #ifdef CONFIG_PM_SLEEP
 static int snd_ice1712_suspend(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct snd_ice1712 *ice = card->private_data;
 
@@ -2820,16 +2819,11 @@ static int snd_ice1712_suspend(struct device *dev)
 
 	if (ice->pm_suspend)
 		ice->pm_suspend(ice);
-
-	pci_disable_device(pci);
-	pci_save_state(pci);
-	pci_set_power_state(pci, PCI_D3hot);
 	return 0;
 }
 
 static int snd_ice1712_resume(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct snd_ice1712 *ice = card->private_data;
 	int rate;
@@ -2837,16 +2831,6 @@ static int snd_ice1712_resume(struct device *dev)
 	if (!ice->pm_suspend_enabled)
 		return 0;
 
-	pci_set_power_state(pci, PCI_D0);
-	pci_restore_state(pci);
-
-	if (pci_enable_device(pci) < 0) {
-		snd_card_disconnect(card);
-		return -EIO;
-	}
-
-	pci_set_master(pci);
-
 	if (ice->cur_rate)
 		rate = ice->cur_rate;
 	else
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 20/33] ALSA: ice1724: Simplify PM callbacks
  2015-01-09 15:52 [PATCH 00/33] Simplify PM callbacks of PCI drivers Takashi Iwai
                   ` (18 preceding siblings ...)
  2015-01-09 15:53 ` [PATCH 19/33] ALSA: ice1712: " Takashi Iwai
@ 2015-01-09 15:53 ` Takashi Iwai
  2015-01-09 15:53 ` [PATCH 21/33] ALSA: intel8x0: " Takashi Iwai
                   ` (12 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Takashi Iwai @ 2015-01-09 15:53 UTC (permalink / raw)
  To: alsa-devel

This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801:
PCI core handles power state for us].

Since pci_set_power_state(), pci_save_state() and pci_restore_state()
are already done in the PCI core side, so we don't need to it doubly.

Also, pci_enable_device(), pci_disable_device() and pci_set_master()
calls in PM callbacks are superfluous nowadays, too, so get rid of
them as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/ice1712/ice1724.c | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c
index d73da157ea14..0b22c00642bb 100644
--- a/sound/pci/ice1712/ice1724.c
+++ b/sound/pci/ice1712/ice1724.c
@@ -2798,7 +2798,6 @@ static void snd_vt1724_remove(struct pci_dev *pci)
 #ifdef CONFIG_PM_SLEEP
 static int snd_vt1724_suspend(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct snd_ice1712 *ice = card->private_data;
 
@@ -2821,32 +2820,17 @@ static int snd_vt1724_suspend(struct device *dev)
 
 	if (ice->pm_suspend)
 		ice->pm_suspend(ice);
-
-	pci_disable_device(pci);
-	pci_save_state(pci);
-	pci_set_power_state(pci, PCI_D3hot);
 	return 0;
 }
 
 static int snd_vt1724_resume(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct snd_ice1712 *ice = card->private_data;
 
 	if (!ice->pm_suspend_enabled)
 		return 0;
 
-	pci_set_power_state(pci, PCI_D0);
-	pci_restore_state(pci);
-
-	if (pci_enable_device(pci) < 0) {
-		snd_card_disconnect(card);
-		return -EIO;
-	}
-
-	pci_set_master(pci);
-
 	snd_vt1724_chip_reset(ice);
 
 	if (snd_vt1724_chip_init(ice) < 0) {
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 21/33] ALSA: intel8x0: Simplify PM callbacks
  2015-01-09 15:52 [PATCH 00/33] Simplify PM callbacks of PCI drivers Takashi Iwai
                   ` (19 preceding siblings ...)
  2015-01-09 15:53 ` [PATCH 20/33] ALSA: ice1724: " Takashi Iwai
@ 2015-01-09 15:53 ` Takashi Iwai
  2015-01-09 15:53 ` [PATCH 22/33] ALSA: intel8x0m: " Takashi Iwai
                   ` (11 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Takashi Iwai @ 2015-01-09 15:53 UTC (permalink / raw)
  To: alsa-devel

This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801:
PCI core handles power state for us].

Since pci_set_power_state(), pci_save_state() and pci_restore_state()
are already done in the PCI core side, so we don't need to it doubly.

Also, pci_enable_device(), pci_disable_device() and pci_set_master()
calls in PM callbacks are superfluous nowadays, too, so get rid of
them as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/intel8x0.c | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index 4a28252a42b9..67f9e8b77385 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -2654,7 +2654,6 @@ static int snd_intel8x0_free(struct intel8x0 *chip)
  */
 static int intel8x0_suspend(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct intel8x0 *chip = card->private_data;
 	int i;
@@ -2682,12 +2681,6 @@ static int intel8x0_suspend(struct device *dev)
 		free_irq(chip->irq, chip);
 		chip->irq = -1;
 	}
-	pci_disable_device(pci);
-	pci_save_state(pci);
-	/* The call below may disable built-in speaker on some laptops
-	 * after S2RAM.  So, don't touch it.
-	 */
-	/* pci_set_power_state(pci, PCI_D3hot); */
 	return 0;
 }
 
@@ -2698,14 +2691,6 @@ static int intel8x0_resume(struct device *dev)
 	struct intel8x0 *chip = card->private_data;
 	int i;
 
-	pci_set_power_state(pci, PCI_D0);
-	pci_restore_state(pci);
-	if (pci_enable_device(pci) < 0) {
-		dev_err(dev, "pci_enable_device failed, disabling device\n");
-		snd_card_disconnect(card);
-		return -EIO;
-	}
-	pci_set_master(pci);
 	snd_intel8x0_chip_init(chip, 0);
 	if (request_irq(pci->irq, snd_intel8x0_interrupt,
 			IRQF_SHARED, KBUILD_MODNAME, chip)) {
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 22/33] ALSA: intel8x0m: Simplify PM callbacks
  2015-01-09 15:52 [PATCH 00/33] Simplify PM callbacks of PCI drivers Takashi Iwai
                   ` (20 preceding siblings ...)
  2015-01-09 15:53 ` [PATCH 21/33] ALSA: intel8x0: " Takashi Iwai
@ 2015-01-09 15:53 ` Takashi Iwai
  2015-01-09 15:53 ` [PATCH 23/33] ALSA: maestro3: " Takashi Iwai
                   ` (10 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Takashi Iwai @ 2015-01-09 15:53 UTC (permalink / raw)
  To: alsa-devel

This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801:
PCI core handles power state for us].

Since pci_set_power_state(), pci_save_state() and pci_restore_state()
are already done in the PCI core side, so we don't need to it doubly.

Also, pci_enable_device(), pci_disable_device() and pci_set_master()
calls in PM callbacks are superfluous nowadays, too, so get rid of
them as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/intel8x0m.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c
index 6b40235be13c..748f6f67c982 100644
--- a/sound/pci/intel8x0m.c
+++ b/sound/pci/intel8x0m.c
@@ -1023,7 +1023,6 @@ static int snd_intel8x0m_free(struct intel8x0m *chip)
  */
 static int intel8x0m_suspend(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct intel8x0m *chip = card->private_data;
 	int i;
@@ -1036,9 +1035,6 @@ static int intel8x0m_suspend(struct device *dev)
 		free_irq(chip->irq, chip);
 		chip->irq = -1;
 	}
-	pci_disable_device(pci);
-	pci_save_state(pci);
-	pci_set_power_state(pci, PCI_D3hot);
 	return 0;
 }
 
@@ -1048,14 +1044,6 @@ static int intel8x0m_resume(struct device *dev)
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct intel8x0m *chip = card->private_data;
 
-	pci_set_power_state(pci, PCI_D0);
-	pci_restore_state(pci);
-	if (pci_enable_device(pci) < 0) {
-		dev_err(dev, "pci_enable_device failed, disabling device\n");
-		snd_card_disconnect(card);
-		return -EIO;
-	}
-	pci_set_master(pci);
 	if (request_irq(pci->irq, snd_intel8x0m_interrupt,
 			IRQF_SHARED, KBUILD_MODNAME, chip)) {
 		dev_err(dev, "unable to grab IRQ %d, disabling device\n",
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 23/33] ALSA: maestro3: Simplify PM callbacks
  2015-01-09 15:52 [PATCH 00/33] Simplify PM callbacks of PCI drivers Takashi Iwai
                   ` (21 preceding siblings ...)
  2015-01-09 15:53 ` [PATCH 22/33] ALSA: intel8x0m: " Takashi Iwai
@ 2015-01-09 15:53 ` Takashi Iwai
  2015-01-09 15:53 ` [PATCH 24/33] ALSA: nm256: " Takashi Iwai
                   ` (9 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Takashi Iwai @ 2015-01-09 15:53 UTC (permalink / raw)
  To: alsa-devel

This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801:
PCI core handles power state for us].

Since pci_set_power_state(), pci_save_state() and pci_restore_state()
are already done in the PCI core side, so we don't need to it doubly.

Also, pci_enable_device(), pci_disable_device() and pci_set_master()
calls in PM callbacks are superfluous nowadays, too, so get rid of
them as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/maestro3.c | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c
index 98823d11d485..18a60be63266 100644
--- a/sound/pci/maestro3.c
+++ b/sound/pci/maestro3.c
@@ -2395,7 +2395,6 @@ static int snd_m3_free(struct snd_m3 *chip)
 #ifdef CONFIG_PM_SLEEP
 static int m3_suspend(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct snd_m3 *chip = card->private_data;
 	int i, dsp_index;
@@ -2421,16 +2420,11 @@ static int m3_suspend(struct device *dev)
 	for (i = REV_B_DATA_MEMORY_BEGIN ; i <= REV_B_DATA_MEMORY_END; i++)
 		chip->suspend_mem[dsp_index++] =
 			snd_m3_assp_read(chip, MEMTYPE_INTERNAL_DATA, i);
-
-	pci_disable_device(pci);
-	pci_save_state(pci);
-	pci_set_power_state(pci, PCI_D3hot);
 	return 0;
 }
 
 static int m3_resume(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct snd_m3 *chip = card->private_data;
 	int i, dsp_index;
@@ -2438,15 +2432,6 @@ static int m3_resume(struct device *dev)
 	if (chip->suspend_mem == NULL)
 		return 0;
 
-	pci_set_power_state(pci, PCI_D0);
-	pci_restore_state(pci);
-	if (pci_enable_device(pci) < 0) {
-		dev_err(dev, "pci_enable_device failed, disabling device\n");
-		snd_card_disconnect(card);
-		return -EIO;
-	}
-	pci_set_master(pci);
-
 	/* first lets just bring everything back. .*/
 	snd_m3_outw(chip, 0, 0x54);
 	snd_m3_outw(chip, 0, 0x56);
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 24/33] ALSA: nm256: Simplify PM callbacks
  2015-01-09 15:52 [PATCH 00/33] Simplify PM callbacks of PCI drivers Takashi Iwai
                   ` (22 preceding siblings ...)
  2015-01-09 15:53 ` [PATCH 23/33] ALSA: maestro3: " Takashi Iwai
@ 2015-01-09 15:53 ` Takashi Iwai
  2015-01-09 15:53 ` [PATCH 25/33] ALSA: oxygen: " Takashi Iwai
                   ` (8 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Takashi Iwai @ 2015-01-09 15:53 UTC (permalink / raw)
  To: alsa-devel

This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801:
PCI core handles power state for us].

Since pci_set_power_state(), pci_save_state() and pci_restore_state()
are already done in the PCI core side, so we don't need to it doubly.

Also, pci_enable_device(), pci_disable_device() and pci_set_master()
calls in PM callbacks are superfluous nowadays, too, so get rid of
them as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/nm256/nm256.c | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c
index 4e41a4e29a1e..8598f2b47eb3 100644
--- a/sound/pci/nm256/nm256.c
+++ b/sound/pci/nm256/nm256.c
@@ -1392,7 +1392,6 @@ snd_nm256_peek_for_sig(struct nm256 *chip)
  */
 static int nm256_suspend(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct nm256 *chip = card->private_data;
 
@@ -1400,15 +1399,11 @@ static int nm256_suspend(struct device *dev)
 	snd_pcm_suspend_all(chip->pcm);
 	snd_ac97_suspend(chip->ac97);
 	chip->coeffs_current = 0;
-	pci_disable_device(pci);
-	pci_save_state(pci);
-	pci_set_power_state(pci, PCI_D3hot);
 	return 0;
 }
 
 static int nm256_resume(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct nm256 *chip = card->private_data;
 	int i;
@@ -1416,15 +1411,6 @@ static int nm256_resume(struct device *dev)
 	/* Perform a full reset on the hardware */
 	chip->in_resume = 1;
 
-	pci_set_power_state(pci, PCI_D0);
-	pci_restore_state(pci);
-	if (pci_enable_device(pci) < 0) {
-		dev_err(dev, "pci_enable_device failed, disabling device\n");
-		snd_card_disconnect(card);
-		return -EIO;
-	}
-	pci_set_master(pci);
-
 	snd_nm256_init_chip(chip);
 
 	/* restore ac97 */
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 25/33] ALSA: oxygen: Simplify PM callbacks
  2015-01-09 15:52 [PATCH 00/33] Simplify PM callbacks of PCI drivers Takashi Iwai
                   ` (23 preceding siblings ...)
  2015-01-09 15:53 ` [PATCH 24/33] ALSA: nm256: " Takashi Iwai
@ 2015-01-09 15:53 ` Takashi Iwai
  2015-01-09 16:24   ` Clemens Ladisch
  2015-01-09 15:53 ` [PATCH 26/33] ALSA: riptide: " Takashi Iwai
                   ` (7 subsequent siblings)
  32 siblings, 1 reply; 35+ messages in thread
From: Takashi Iwai @ 2015-01-09 15:53 UTC (permalink / raw)
  To: alsa-devel

This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801:
PCI core handles power state for us].

Since pci_set_power_state(), pci_save_state() and pci_restore_state()
are already done in the PCI core side, so we don't need to it doubly.

Also, pci_enable_device(), pci_disable_device() and pci_set_master()
calls in PM callbacks are superfluous nowadays, too, so get rid of
them as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/oxygen/oxygen_lib.c | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c
index b67e30602473..366723cf6d7a 100644
--- a/sound/pci/oxygen/oxygen_lib.c
+++ b/sound/pci/oxygen/oxygen_lib.c
@@ -728,7 +728,6 @@ EXPORT_SYMBOL(oxygen_pci_remove);
 #ifdef CONFIG_PM_SLEEP
 static int oxygen_pci_suspend(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct oxygen *chip = card->private_data;
 	unsigned int i, saved_interrupt_mask;
@@ -753,10 +752,6 @@ static int oxygen_pci_suspend(struct device *dev)
 	flush_work(&chip->spdif_input_bits_work);
 	flush_work(&chip->gpio_work);
 	chip->interrupt_mask = saved_interrupt_mask;
-
-	pci_disable_device(pci);
-	pci_save_state(pci);
-	pci_set_power_state(pci, PCI_D3hot);
 	return 0;
 }
 
@@ -788,20 +783,10 @@ static void oxygen_restore_ac97(struct oxygen *chip, unsigned int codec)
 
 static int oxygen_pci_resume(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct oxygen *chip = card->private_data;
 	unsigned int i;
 
-	pci_set_power_state(pci, PCI_D0);
-	pci_restore_state(pci);
-	if (pci_enable_device(pci) < 0) {
-		dev_err(dev, "cannot reenable device");
-		snd_card_disconnect(card);
-		return -EIO;
-	}
-	pci_set_master(pci);
-
 	oxygen_write16(chip, OXYGEN_DMA_STATUS, 0);
 	oxygen_write16(chip, OXYGEN_INTERRUPT_MASK, 0);
 	for (i = 0; i < OXYGEN_IO_SIZE; ++i)
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 26/33] ALSA: riptide: Simplify PM callbacks
  2015-01-09 15:52 [PATCH 00/33] Simplify PM callbacks of PCI drivers Takashi Iwai
                   ` (24 preceding siblings ...)
  2015-01-09 15:53 ` [PATCH 25/33] ALSA: oxygen: " Takashi Iwai
@ 2015-01-09 15:53 ` Takashi Iwai
  2015-01-09 15:53 ` [PATCH 27/33] ALSA: rme96: " Takashi Iwai
                   ` (6 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Takashi Iwai @ 2015-01-09 15:53 UTC (permalink / raw)
  To: alsa-devel

This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801:
PCI core handles power state for us].

Since pci_set_power_state(), pci_save_state() and pci_restore_state()
are already done in the PCI core side, so we don't need to it doubly.

Also, pci_enable_device(), pci_disable_device() and pci_set_master()
calls in PM callbacks are superfluous nowadays, too, so get rid of
them as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/riptide/riptide.c | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
index 6abc2ac8fffb..7e922fa24de5 100644
--- a/sound/pci/riptide/riptide.c
+++ b/sound/pci/riptide/riptide.c
@@ -1153,7 +1153,6 @@ static void riptide_handleirq(unsigned long dev_id)
 #ifdef CONFIG_PM_SLEEP
 static int riptide_suspend(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct snd_riptide *chip = card->private_data;
 
@@ -1161,27 +1160,14 @@ static int riptide_suspend(struct device *dev)
 	snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
 	snd_pcm_suspend_all(chip->pcm);
 	snd_ac97_suspend(chip->ac97);
-	pci_disable_device(pci);
-	pci_save_state(pci);
-	pci_set_power_state(pci, PCI_D3hot);
 	return 0;
 }
 
 static int riptide_resume(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct snd_riptide *chip = card->private_data;
 
-	pci_set_power_state(pci, PCI_D0);
-	pci_restore_state(pci);
-	if (pci_enable_device(pci) < 0) {
-		printk(KERN_ERR "riptide: pci_enable_device failed, "
-		       "disabling device\n");
-		snd_card_disconnect(card);
-		return -EIO;
-	}
-	pci_set_master(pci);
 	snd_riptide_initialize(chip);
 	snd_ac97_resume(chip->ac97);
 	snd_power_change_state(card, SNDRV_CTL_POWER_D0);
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 27/33] ALSA: rme96: Simplify PM callbacks
  2015-01-09 15:52 [PATCH 00/33] Simplify PM callbacks of PCI drivers Takashi Iwai
                   ` (25 preceding siblings ...)
  2015-01-09 15:53 ` [PATCH 26/33] ALSA: riptide: " Takashi Iwai
@ 2015-01-09 15:53 ` Takashi Iwai
  2015-01-09 15:53 ` [PATCH 28/33] ALSA: sis7019: " Takashi Iwai
                   ` (5 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Takashi Iwai @ 2015-01-09 15:53 UTC (permalink / raw)
  To: alsa-devel

This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801:
PCI core handles power state for us].

Since pci_set_power_state(), pci_save_state() and pci_restore_state()
are already done in the PCI core side, so we don't need to it doubly.

Also, pci_enable_device(), pci_disable_device() and pci_set_master()
calls in PM callbacks are superfluous nowadays, too, so get rid of
them as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/rme96.c | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c
index 2f1a85185a16..e33e79eadf83 100644
--- a/sound/pci/rme96.c
+++ b/sound/pci/rme96.c
@@ -2358,7 +2358,6 @@ snd_rme96_create_switches(struct snd_card *card,
 
 static int rme96_suspend(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct rme96 *rme96 = card->private_data;
 
@@ -2381,26 +2380,14 @@ static int rme96_suspend(struct device *dev)
 	/* disable the DAC  */
 	rme96->areg &= ~RME96_AR_DAC_EN;
 	writel(rme96->areg, rme96->iobase + RME96_IO_ADDITIONAL_REG);
-
-	pci_disable_device(pci);
-	pci_save_state(pci);
-
 	return 0;
 }
 
 static int rme96_resume(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct rme96 *rme96 = card->private_data;
 
-	pci_restore_state(pci);
-	if (pci_enable_device(pci) < 0) {
-		dev_err(dev, "pci_enable_device failed, disabling device\n");
-		snd_card_disconnect(card);
-		return -EIO;
-	}
-
 	/* reset playback and record buffer pointers */
 	writel(0, rme96->iobase + RME96_IO_SET_PLAY_POS
 		  + rme96->playback_pointer);
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 28/33] ALSA: sis7019: Simplify PM callbacks
  2015-01-09 15:52 [PATCH 00/33] Simplify PM callbacks of PCI drivers Takashi Iwai
                   ` (26 preceding siblings ...)
  2015-01-09 15:53 ` [PATCH 27/33] ALSA: rme96: " Takashi Iwai
@ 2015-01-09 15:53 ` Takashi Iwai
  2015-01-09 15:53 ` [PATCH 29/33] ALSA: trident: " Takashi Iwai
                   ` (4 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Takashi Iwai @ 2015-01-09 15:53 UTC (permalink / raw)
  To: alsa-devel

This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801:
PCI core handles power state for us].

Since pci_set_power_state(), pci_save_state() and pci_restore_state()
are already done in the PCI core side, so we don't need to it doubly.

Also, pci_enable_device(), pci_disable_device() and pci_set_master()
calls in PM callbacks are superfluous nowadays, too, so get rid of
them as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/sis7019.c | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/sound/pci/sis7019.c b/sound/pci/sis7019.c
index 7f6a0a0d115a..be8952f6804d 100644
--- a/sound/pci/sis7019.c
+++ b/sound/pci/sis7019.c
@@ -1211,7 +1211,6 @@ static int sis_chip_init(struct sis7019 *sis)
 #ifdef CONFIG_PM_SLEEP
 static int sis_suspend(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct sis7019 *sis = card->private_data;
 	void __iomem *ioaddr = sis->ioaddr;
@@ -1240,9 +1239,6 @@ static int sis_suspend(struct device *dev)
 		ioaddr += 4096;
 	}
 
-	pci_disable_device(pci);
-	pci_save_state(pci);
-	pci_set_power_state(pci, PCI_D3hot);
 	return 0;
 }
 
@@ -1254,14 +1250,6 @@ static int sis_resume(struct device *dev)
 	void __iomem *ioaddr = sis->ioaddr;
 	int i;
 
-	pci_set_power_state(pci, PCI_D0);
-	pci_restore_state(pci);
-
-	if (pci_enable_device(pci) < 0) {
-		dev_err(&pci->dev, "unable to re-enable device\n");
-		goto error;
-	}
-
 	if (sis_chip_init(sis)) {
 		dev_err(&pci->dev, "unable to re-init controller\n");
 		goto error;
@@ -1284,7 +1272,6 @@ static int sis_resume(struct device *dev)
 	memset(sis->suspend_state[0], 0, 4096);
 
 	sis->irq = pci->irq;
-	pci_set_master(pci);
 
 	if (sis->codecs_present & SIS_PRIMARY_CODEC_PRESENT)
 		snd_ac97_resume(sis->ac97[0]);
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 29/33] ALSA: trident: Simplify PM callbacks
  2015-01-09 15:52 [PATCH 00/33] Simplify PM callbacks of PCI drivers Takashi Iwai
                   ` (27 preceding siblings ...)
  2015-01-09 15:53 ` [PATCH 28/33] ALSA: sis7019: " Takashi Iwai
@ 2015-01-09 15:53 ` Takashi Iwai
  2015-01-09 15:53 ` [PATCH 30/33] ALSA: via82xx: " Takashi Iwai
                   ` (3 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Takashi Iwai @ 2015-01-09 15:53 UTC (permalink / raw)
  To: alsa-devel

This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801:
PCI core handles power state for us].

Since pci_set_power_state(), pci_save_state() and pci_restore_state()
are already done in the PCI core side, so we don't need to it doubly.

Also, pci_enable_device(), pci_disable_device() and pci_set_master()
calls in PM callbacks are superfluous nowadays, too, so get rid of
them as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/trident/trident_main.c | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c
index 57cd757acfe7..072824982ff8 100644
--- a/sound/pci/trident/trident_main.c
+++ b/sound/pci/trident/trident_main.c
@@ -3926,7 +3926,6 @@ static void snd_trident_clear_voices(struct snd_trident * trident, unsigned shor
 #ifdef CONFIG_PM_SLEEP
 static int snd_trident_suspend(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct snd_trident *trident = card->private_data;
 
@@ -3938,28 +3937,14 @@ static int snd_trident_suspend(struct device *dev)
 
 	snd_ac97_suspend(trident->ac97);
 	snd_ac97_suspend(trident->ac97_sec);
-
-	pci_disable_device(pci);
-	pci_save_state(pci);
-	pci_set_power_state(pci, PCI_D3hot);
 	return 0;
 }
 
 static int snd_trident_resume(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct snd_trident *trident = card->private_data;
 
-	pci_set_power_state(pci, PCI_D0);
-	pci_restore_state(pci);
-	if (pci_enable_device(pci) < 0) {
-		dev_err(dev, "pci_enable_device failed, disabling device\n");
-		snd_card_disconnect(card);
-		return -EIO;
-	}
-	pci_set_master(pci);
-
 	switch (trident->device) {
 	case TRIDENT_DEVICE_ID_DX:
 		snd_trident_4d_dx_init(trident);
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 30/33] ALSA: via82xx: Simplify PM callbacks
  2015-01-09 15:52 [PATCH 00/33] Simplify PM callbacks of PCI drivers Takashi Iwai
                   ` (28 preceding siblings ...)
  2015-01-09 15:53 ` [PATCH 29/33] ALSA: trident: " Takashi Iwai
@ 2015-01-09 15:53 ` Takashi Iwai
  2015-01-09 15:53 ` [PATCH 31/33] ALSA: via82xx-modem: " Takashi Iwai
                   ` (2 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Takashi Iwai @ 2015-01-09 15:53 UTC (permalink / raw)
  To: alsa-devel

This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801:
PCI core handles power state for us].

Since pci_set_power_state(), pci_save_state() and pci_restore_state()
are already done in the PCI core side, so we don't need to it doubly.

Also, pci_enable_device(), pci_disable_device() and pci_set_master()
calls in PM callbacks are superfluous nowadays, too, so get rid of
them as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/via82xx.c | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index e088467fb736..120fccbb2461 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -2271,7 +2271,6 @@ static int snd_via82xx_chip_init(struct via82xx *chip)
  */
 static int snd_via82xx_suspend(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct via82xx *chip = card->private_data;
 	int i;
@@ -2291,28 +2290,15 @@ static int snd_via82xx_suspend(struct device *dev)
 		chip->capture_src_saved[1] = inb(chip->port + VIA_REG_CAPTURE_CHANNEL + 0x10);
 	}
 
-	pci_disable_device(pci);
-	pci_save_state(pci);
-	pci_set_power_state(pci, PCI_D3hot);
 	return 0;
 }
 
 static int snd_via82xx_resume(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct via82xx *chip = card->private_data;
 	int i;
 
-	pci_set_power_state(pci, PCI_D0);
-	pci_restore_state(pci);
-	if (pci_enable_device(pci) < 0) {
-		dev_err(dev, "pci_enable_device failed, disabling device\n");
-		snd_card_disconnect(card);
-		return -EIO;
-	}
-	pci_set_master(pci);
-
 	snd_via82xx_chip_init(chip);
 
 	if (chip->chip_type == TYPE_VIA686) {
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 31/33] ALSA: via82xx-modem: Simplify PM callbacks
  2015-01-09 15:52 [PATCH 00/33] Simplify PM callbacks of PCI drivers Takashi Iwai
                   ` (29 preceding siblings ...)
  2015-01-09 15:53 ` [PATCH 30/33] ALSA: via82xx: " Takashi Iwai
@ 2015-01-09 15:53 ` Takashi Iwai
  2015-01-09 15:53 ` [PATCH 32/33] ALSA: vx222: " Takashi Iwai
  2015-01-09 15:53 ` [PATCH 33/33] ALSA: ymfpci: " Takashi Iwai
  32 siblings, 0 replies; 35+ messages in thread
From: Takashi Iwai @ 2015-01-09 15:53 UTC (permalink / raw)
  To: alsa-devel

This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801:
PCI core handles power state for us].

Since pci_set_power_state(), pci_save_state() and pci_restore_state()
are already done in the PCI core side, so we don't need to it doubly.

Also, pci_enable_device(), pci_disable_device() and pci_set_master()
calls in PM callbacks are superfluous nowadays, too, so get rid of
them as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/via82xx_modem.c | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c
index fd46ffe12e4f..884f49eea495 100644
--- a/sound/pci/via82xx_modem.c
+++ b/sound/pci/via82xx_modem.c
@@ -1031,7 +1031,6 @@ static int snd_via82xx_chip_init(struct via82xx_modem *chip)
  */
 static int snd_via82xx_suspend(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct via82xx_modem *chip = card->private_data;
 	int i;
@@ -1043,29 +1042,15 @@ static int snd_via82xx_suspend(struct device *dev)
 		snd_via82xx_channel_reset(chip, &chip->devs[i]);
 	synchronize_irq(chip->irq);
 	snd_ac97_suspend(chip->ac97);
-
-	pci_disable_device(pci);
-	pci_save_state(pci);
-	pci_set_power_state(pci, PCI_D3hot);
 	return 0;
 }
 
 static int snd_via82xx_resume(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct via82xx_modem *chip = card->private_data;
 	int i;
 
-	pci_set_power_state(pci, PCI_D0);
-	pci_restore_state(pci);
-	if (pci_enable_device(pci) < 0) {
-		dev_err(dev, "pci_enable_device failed, disabling device\n");
-		snd_card_disconnect(card);
-		return -EIO;
-	}
-	pci_set_master(pci);
-
 	snd_via82xx_chip_init(chip);
 
 	snd_ac97_resume(chip->ac97);
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 32/33] ALSA: vx222: Simplify PM callbacks
  2015-01-09 15:52 [PATCH 00/33] Simplify PM callbacks of PCI drivers Takashi Iwai
                   ` (30 preceding siblings ...)
  2015-01-09 15:53 ` [PATCH 31/33] ALSA: via82xx-modem: " Takashi Iwai
@ 2015-01-09 15:53 ` Takashi Iwai
  2015-01-09 15:53 ` [PATCH 33/33] ALSA: ymfpci: " Takashi Iwai
  32 siblings, 0 replies; 35+ messages in thread
From: Takashi Iwai @ 2015-01-09 15:53 UTC (permalink / raw)
  To: alsa-devel

This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801:
PCI core handles power state for us].

Since pci_set_power_state(), pci_save_state() and pci_restore_state()
are already done in the PCI core side, so we don't need to it doubly.

Also, pci_enable_device(), pci_disable_device() and pci_set_master()
calls in PM callbacks are superfluous nowadays, too, so get rid of
them as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/vx222/vx222.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

diff --git a/sound/pci/vx222/vx222.c b/sound/pci/vx222/vx222.c
index c5a25e39e3a8..ecbaf473fc1e 100644
--- a/sound/pci/vx222/vx222.c
+++ b/sound/pci/vx222/vx222.c
@@ -259,32 +259,17 @@ static void snd_vx222_remove(struct pci_dev *pci)
 #ifdef CONFIG_PM_SLEEP
 static int snd_vx222_suspend(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct snd_vx222 *vx = card->private_data;
-	int err;
 
-	err = snd_vx_suspend(&vx->core);
-	pci_disable_device(pci);
-	pci_save_state(pci);
-	pci_set_power_state(pci, PCI_D3hot);
-	return err;
+	return snd_vx_suspend(&vx->core);
 }
 
 static int snd_vx222_resume(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct snd_vx222 *vx = card->private_data;
 
-	pci_set_power_state(pci, PCI_D0);
-	pci_restore_state(pci);
-	if (pci_enable_device(pci) < 0) {
-		dev_err(dev, "pci_enable_device failed, disabling device\n");
-		snd_card_disconnect(card);
-		return -EIO;
-	}
-	pci_set_master(pci);
 	return snd_vx_resume(&vx->core);
 }
 
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 33/33] ALSA: ymfpci: Simplify PM callbacks
  2015-01-09 15:52 [PATCH 00/33] Simplify PM callbacks of PCI drivers Takashi Iwai
                   ` (31 preceding siblings ...)
  2015-01-09 15:53 ` [PATCH 32/33] ALSA: vx222: " Takashi Iwai
@ 2015-01-09 15:53 ` Takashi Iwai
  32 siblings, 0 replies; 35+ messages in thread
From: Takashi Iwai @ 2015-01-09 15:53 UTC (permalink / raw)
  To: alsa-devel

This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801:
PCI core handles power state for us].

Since pci_set_power_state(), pci_save_state() and pci_restore_state()
are already done in the PCI core side, so we don't need to it doubly.

Also, pci_enable_device(), pci_disable_device() and pci_set_master()
calls in PM callbacks are superfluous nowadays, too, so get rid of
them as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/ymfpci/ymfpci_main.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
index 81c916a5eb96..2b0b8f559ab3 100644
--- a/sound/pci/ymfpci/ymfpci_main.c
+++ b/sound/pci/ymfpci/ymfpci_main.c
@@ -2326,7 +2326,6 @@ static int saved_regs_index[] = {
 
 static int snd_ymfpci_suspend(struct device *dev)
 {
-	struct pci_dev *pci = to_pci_dev(dev);
 	struct snd_card *card = dev_get_drvdata(dev);
 	struct snd_ymfpci *chip = card->private_data;
 	unsigned int i;
@@ -2347,9 +2346,6 @@ static int snd_ymfpci_suspend(struct device *dev)
 	snd_ymfpci_writel(chip, YDSXGR_NATIVEDACOUTVOL, 0);
 	snd_ymfpci_writel(chip, YDSXGR_BUF441OUTVOL, 0);
 	snd_ymfpci_disable_dsp(chip);
-	pci_disable_device(pci);
-	pci_save_state(pci);
-	pci_set_power_state(pci, PCI_D3hot);
 	return 0;
 }
 
@@ -2360,14 +2356,6 @@ static int snd_ymfpci_resume(struct device *dev)
 	struct snd_ymfpci *chip = card->private_data;
 	unsigned int i;
 
-	pci_set_power_state(pci, PCI_D0);
-	pci_restore_state(pci);
-	if (pci_enable_device(pci) < 0) {
-		dev_err(dev, "pci_enable_device failed, disabling device\n");
-		snd_card_disconnect(card);
-		return -EIO;
-	}
-	pci_set_master(pci);
 	snd_ymfpci_aclink_reset(pci);
 	snd_ymfpci_codec_ready(chip, 0);
 	snd_ymfpci_download_image(chip);
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* Re: [PATCH 25/33] ALSA: oxygen: Simplify PM callbacks
  2015-01-09 15:53 ` [PATCH 25/33] ALSA: oxygen: " Takashi Iwai
@ 2015-01-09 16:24   ` Clemens Ladisch
  0 siblings, 0 replies; 35+ messages in thread
From: Clemens Ladisch @ 2015-01-09 16:24 UTC (permalink / raw)
  To: Takashi Iwai, alsa-devel

Takashi Iwai wrote:
> This is a similar cleanup like the commit [3db084fd0af5: ALSA: fm801:
> PCI core handles power state for us].
>
> Since pci_set_power_state(), pci_save_state() and pci_restore_state()
> are already done in the PCI core side, so we don't need to it doubly.
>
> Also, pci_enable_device(), pci_disable_device() and pci_set_master()
> calls in PM callbacks are superfluous nowadays, too, so get rid of
> them as well.
>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>

Acked-by: Clemens Ladisch <clemens@ladisch.de>

> ---
>  sound/pci/oxygen/oxygen_lib.c | 15 ---------------
>  1 file changed, 15 deletions(-)
>
> diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c
> index b67e30602473..366723cf6d7a 100644
> --- a/sound/pci/oxygen/oxygen_lib.c
> +++ b/sound/pci/oxygen/oxygen_lib.c
> @@ -728,7 +728,6 @@ EXPORT_SYMBOL(oxygen_pci_remove);
>  #ifdef CONFIG_PM_SLEEP
>  static int oxygen_pci_suspend(struct device *dev)
>  {
> -	struct pci_dev *pci = to_pci_dev(dev);
>  	struct snd_card *card = dev_get_drvdata(dev);
>  	struct oxygen *chip = card->private_data;
>  	unsigned int i, saved_interrupt_mask;
> @@ -753,10 +752,6 @@ static int oxygen_pci_suspend(struct device *dev)
>  	flush_work(&chip->spdif_input_bits_work);
>  	flush_work(&chip->gpio_work);
>  	chip->interrupt_mask = saved_interrupt_mask;
> -
> -	pci_disable_device(pci);
> -	pci_save_state(pci);
> -	pci_set_power_state(pci, PCI_D3hot);
>  	return 0;
>  }
>
> @@ -788,20 +783,10 @@ static void oxygen_restore_ac97(struct oxygen *chip, unsigned int codec)
>
>  static int oxygen_pci_resume(struct device *dev)
>  {
> -	struct pci_dev *pci = to_pci_dev(dev);
>  	struct snd_card *card = dev_get_drvdata(dev);
>  	struct oxygen *chip = card->private_data;
>  	unsigned int i;
>
> -	pci_set_power_state(pci, PCI_D0);
> -	pci_restore_state(pci);
> -	if (pci_enable_device(pci) < 0) {
> -		dev_err(dev, "cannot reenable device");
> -		snd_card_disconnect(card);
> -		return -EIO;
> -	}
> -	pci_set_master(pci);
> -
>  	oxygen_write16(chip, OXYGEN_DMA_STATUS, 0);
>  	oxygen_write16(chip, OXYGEN_INTERRUPT_MASK, 0);
>  	for (i = 0; i < OXYGEN_IO_SIZE; ++i)

^ permalink raw reply	[flat|nested] 35+ messages in thread

end of thread, other threads:[~2015-01-09 16:24 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-09 15:52 [PATCH 00/33] Simplify PM callbacks of PCI drivers Takashi Iwai
2015-01-09 15:52 ` [PATCH 01/33] ALSA: ali5451: Simplify PM callbacks Takashi Iwai
2015-01-09 15:52 ` [PATCH 02/33] ALSA: als300: " Takashi Iwai
2015-01-09 15:52 ` [PATCH 03/33] ALSA: als4000: " Takashi Iwai
2015-01-09 15:52 ` [PATCH 04/33] ALSA: atiixp: " Takashi Iwai
2015-01-09 15:52 ` [PATCH 05/33] ALSA: atiixp-modem: " Takashi Iwai
2015-01-09 15:52 ` [PATCH 06/33] ALSA: azt3328: " Takashi Iwai
2015-01-09 15:52 ` [PATCH 07/33] ALSA: ca0106: " Takashi Iwai
2015-01-09 15:52 ` [PATCH 08/33] ALSA: cmipci: " Takashi Iwai
2015-01-09 15:52 ` [PATCH 09/33] ALSA: cs4281: " Takashi Iwai
2015-01-09 15:52 ` [PATCH 10/33] ALSA: cs46xx: " Takashi Iwai
2015-01-09 15:52 ` [PATCH 11/33] ALSA: cs5535audio: " Takashi Iwai
2015-01-09 15:52 ` [PATCH 12/33] ALSA: ctxfi: " Takashi Iwai
2015-01-09 15:52 ` [PATCH 13/33] ALSA: echoaudio: " Takashi Iwai
2015-01-09 15:52 ` [PATCH 14/33] ALSA: emu10k1: " Takashi Iwai
2015-01-09 15:52 ` [PATCH 15/33] ALSA: ens137x: " Takashi Iwai
2015-01-09 15:52 ` [PATCH 16/33] ALSA: es1938: " Takashi Iwai
2015-01-09 15:53 ` [PATCH 17/33] ALSA: es1968: " Takashi Iwai
2015-01-09 15:53 ` [PATCH 18/33] ALSA: hda: " Takashi Iwai
2015-01-09 15:53 ` [PATCH 19/33] ALSA: ice1712: " Takashi Iwai
2015-01-09 15:53 ` [PATCH 20/33] ALSA: ice1724: " Takashi Iwai
2015-01-09 15:53 ` [PATCH 21/33] ALSA: intel8x0: " Takashi Iwai
2015-01-09 15:53 ` [PATCH 22/33] ALSA: intel8x0m: " Takashi Iwai
2015-01-09 15:53 ` [PATCH 23/33] ALSA: maestro3: " Takashi Iwai
2015-01-09 15:53 ` [PATCH 24/33] ALSA: nm256: " Takashi Iwai
2015-01-09 15:53 ` [PATCH 25/33] ALSA: oxygen: " Takashi Iwai
2015-01-09 16:24   ` Clemens Ladisch
2015-01-09 15:53 ` [PATCH 26/33] ALSA: riptide: " Takashi Iwai
2015-01-09 15:53 ` [PATCH 27/33] ALSA: rme96: " Takashi Iwai
2015-01-09 15:53 ` [PATCH 28/33] ALSA: sis7019: " Takashi Iwai
2015-01-09 15:53 ` [PATCH 29/33] ALSA: trident: " Takashi Iwai
2015-01-09 15:53 ` [PATCH 30/33] ALSA: via82xx: " Takashi Iwai
2015-01-09 15:53 ` [PATCH 31/33] ALSA: via82xx-modem: " Takashi Iwai
2015-01-09 15:53 ` [PATCH 32/33] ALSA: vx222: " Takashi Iwai
2015-01-09 15:53 ` [PATCH 33/33] ALSA: ymfpci: " Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.