ALSA: Convert to new pm_ops for PCI drivers
authorTakashi Iwai <tiwai@suse.de>
Mon, 2 Jul 2012 13:20:37 +0000 (15:20 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 3 Jul 2012 06:23:03 +0000 (08:23 +0200)
Straightforward conversion to the new pm_ops from the legacy
suspend/resume ops.

Since we change vx222, vx_core and vxpocket have to be converted,
too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
59 files changed:
include/sound/cs46xx.h
include/sound/trident.h
include/sound/vx_core.h
include/sound/ymfpci.h
sound/drivers/vx/vx_core.c
sound/pci/ali5451/ali5451.c
sound/pci/als300.c
sound/pci/als4000.c
sound/pci/atiixp.c
sound/pci/atiixp_modem.c
sound/pci/azt3328.c
sound/pci/ca0106/ca0106_main.c
sound/pci/cmipci.c
sound/pci/cs4281.c
sound/pci/cs46xx/cs46xx.c
sound/pci/cs46xx/cs46xx_lib.c
sound/pci/cs5535audio/cs5535audio.c
sound/pci/cs5535audio/cs5535audio.h
sound/pci/cs5535audio/cs5535audio_pm.c
sound/pci/ctxfi/ctatc.c
sound/pci/ctxfi/ctatc.h
sound/pci/ctxfi/cthardware.h
sound/pci/ctxfi/cthw20k1.c
sound/pci/ctxfi/cthw20k2.c
sound/pci/ctxfi/xfi.c
sound/pci/echoaudio/echoaudio.c
sound/pci/emu10k1/emu10k1.c
sound/pci/ens1370.c
sound/pci/es1938.c
sound/pci/es1968.c
sound/pci/fm801.c
sound/pci/hda/hda_codec.c
sound/pci/hda/hda_codec.h
sound/pci/hda/hda_intel.c
sound/pci/hda/patch_analog.c
sound/pci/hda/patch_cirrus.c
sound/pci/hda/patch_conexant.c
sound/pci/hda/patch_realtek.c
sound/pci/hda/patch_sigmatel.c
sound/pci/hda/patch_via.c
sound/pci/ice1712/ice1724.c
sound/pci/intel8x0.c
sound/pci/intel8x0m.c
sound/pci/maestro3.c
sound/pci/nm256/nm256.c
sound/pci/oxygen/oxygen.c
sound/pci/oxygen/oxygen.h
sound/pci/oxygen/oxygen_lib.c
sound/pci/oxygen/virtuoso.c
sound/pci/riptide/riptide.c
sound/pci/sis7019.c
sound/pci/trident/trident.c
sound/pci/trident/trident_main.c
sound/pci/via82xx.c
sound/pci/via82xx_modem.c
sound/pci/vx222/vx222.c
sound/pci/ymfpci/ymfpci.c
sound/pci/ymfpci/ymfpci_main.c
sound/pcmcia/vx/vxpocket.c

index e3005a674a2491e121b36e6ce5638bce1819e9b1..34a2dd1614fab0eed1bbde6a6cec11fe5dda4174 100644 (file)
@@ -1730,8 +1730,7 @@ int snd_cs46xx_create(struct snd_card *card,
                      struct pci_dev *pci,
                      int external_amp, int thinkpad,
                      struct snd_cs46xx **rcodec);
-int snd_cs46xx_suspend(struct pci_dev *pci, pm_message_t state);
-int snd_cs46xx_resume(struct pci_dev *pci);
+extern const struct dev_pm_ops snd_cs46xx_pm;
 
 int snd_cs46xx_pcm(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm);
 int snd_cs46xx_pcm_rear(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm);
index 9f191a0a1e195882819e5b3a79114cb3bc64bcf5..06f0478103db1dfbcc54b402fe55872e8b11accd 100644 (file)
@@ -430,8 +430,7 @@ void snd_trident_free_voice(struct snd_trident * trident, struct snd_trident_voi
 void snd_trident_start_voice(struct snd_trident * trident, unsigned int voice);
 void snd_trident_stop_voice(struct snd_trident * trident, unsigned int voice);
 void snd_trident_write_voice_regs(struct snd_trident * trident, struct snd_trident_voice *voice);
-int snd_trident_suspend(struct pci_dev *pci, pm_message_t state);
-int snd_trident_resume(struct pci_dev *pci);
+extern const struct dev_pm_ops snd_trident_pm;
 
 /* TLB memory allocation */
 struct snd_util_memblk *snd_trident_alloc_pages(struct snd_trident *trident,
index 5456343ebe4c056957a7670847eae114fe4ab74f..4f67c762cd744fae8380cec92f1a0b8a83ac2119 100644 (file)
@@ -341,7 +341,7 @@ int vx_change_frequency(struct vx_core *chip);
 /*
  * PM
  */
-int snd_vx_suspend(struct vx_core *card, pm_message_t state);
+int snd_vx_suspend(struct vx_core *card);
 int snd_vx_resume(struct vx_core *card);
 
 /*
index 41199664666bb4a96d98b5336f6433b333ef12db..238f118de6e15bb519f6b79ec0018e2e3347fa6f 100644 (file)
@@ -377,8 +377,7 @@ int snd_ymfpci_create(struct snd_card *card,
                      struct snd_ymfpci ** rcodec);
 void snd_ymfpci_free_gameport(struct snd_ymfpci *chip);
 
-int snd_ymfpci_suspend(struct pci_dev *pci, pm_message_t state);
-int snd_ymfpci_resume(struct pci_dev *pci);
+extern const struct dev_pm_ops snd_ymfpci_pm;
 
 int snd_ymfpci_pcm(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm);
 int snd_ymfpci_pcm2(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm);
index b8e515999bc28fda8fac1e04c0f166855bb64b81..de5055a3b0d08194b1e23cea0551525f56174eed 100644 (file)
@@ -725,7 +725,7 @@ EXPORT_SYMBOL(snd_vx_dsp_load);
 /*
  * suspend
  */
-int snd_vx_suspend(struct vx_core *chip, pm_message_t state)
+int snd_vx_suspend(struct vx_core *chip)
 {
        unsigned int i;
 
index 9dfc27bf6cc645d5c1ecc6dd3d2d68920221a570..ee895f3c8605890f39032263485e9bfb99720939 100644 (file)
@@ -1884,9 +1884,10 @@ static int __devinit snd_ali_mixer(struct snd_ali * codec)
 }
 
 #ifdef CONFIG_PM
-static int ali_suspend(struct pci_dev *pci, pm_message_t state)
+static int ali_suspend(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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;
        int i, j;
@@ -1929,13 +1930,14 @@ static int ali_suspend(struct pci_dev *pci, pm_message_t state)
 
        pci_disable_device(pci);
        pci_save_state(pci);
-       pci_set_power_state(pci, pci_choose_state(pci, state));
+       pci_set_power_state(pci, PCI_D3hot);
        return 0;
 }
 
-static int ali_resume(struct pci_dev *pci)
+static int ali_resume(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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;
        int i, j;
@@ -1982,6 +1984,11 @@ static int ali_resume(struct pci_dev *pci)
        snd_power_change_state(card, SNDRV_CTL_POWER_D0);
        return 0;
 }
+
+static SIMPLE_DEV_PM_OPS(ali_pm, ali_suspend, ali_resume);
+#define ALI_PM_OPS     &ali_pm
+#else
+#define ALI_PM_OPS     NULL
 #endif /* CONFIG_PM */
 
 static int snd_ali_free(struct snd_ali * codec)
@@ -2299,10 +2306,9 @@ static struct pci_driver ali5451_driver = {
        .id_table = snd_ali_ids,
        .probe = snd_ali_probe,
        .remove = __devexit_p(snd_ali_remove),
-#ifdef CONFIG_PM
-       .suspend = ali_suspend,
-       .resume = ali_resume,
-#endif
+       .driver = {
+               .pm = ALI_PM_OPS,
+       },
 };                                
 
 module_pci_driver(ali5451_driver);
index 59d65388faf53d890d7ecd9603ac0d772a7a0e48..68c4469c6d1995ed775d49212de6db204da0e668 100644 (file)
@@ -766,9 +766,10 @@ static int __devinit snd_als300_create(struct snd_card *card,
 }
 
 #ifdef CONFIG_PM
-static int snd_als300_suspend(struct pci_dev *pci, pm_message_t state)
+static int snd_als300_suspend(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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);
@@ -777,13 +778,14 @@ static int snd_als300_suspend(struct pci_dev *pci, pm_message_t state)
 
        pci_disable_device(pci);
        pci_save_state(pci);
-       pci_set_power_state(pci, pci_choose_state(pci, state));
+       pci_set_power_state(pci, PCI_D3hot);
        return 0;
 }
 
-static int snd_als300_resume(struct pci_dev *pci)
+static int snd_als300_resume(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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);
@@ -802,6 +804,11 @@ static int snd_als300_resume(struct pci_dev *pci)
        snd_power_change_state(card, SNDRV_CTL_POWER_D0);
        return 0;
 }
+
+static SIMPLE_DEV_PM_OPS(snd_als300_pm, snd_als300_suspend, snd_als300_resume);
+#define SND_ALS300_PM_OPS      &snd_als300_pm
+#else
+#define SND_ALS300_PM_OPS      NULL
 #endif
 
 static int __devinit snd_als300_probe(struct pci_dev *pci,
@@ -857,10 +864,9 @@ static struct pci_driver als300_driver = {
        .id_table = snd_als300_ids,
        .probe = snd_als300_probe,
        .remove = __devexit_p(snd_als300_remove),
-#ifdef CONFIG_PM
-       .suspend = snd_als300_suspend,
-       .resume = snd_als300_resume,
-#endif
+       .driver = {
+               .pm = SND_ALS300_PM_OPS,
+       },
 };
 
 module_pci_driver(als300_driver);
index 7d7f2598c7487c076cec8480f2a35c365bb5b946..0eeca49c57541b3dc85cab82ba389214adab40e1 100644 (file)
@@ -988,9 +988,10 @@ static void __devexit snd_card_als4000_remove(struct pci_dev *pci)
 }
 
 #ifdef CONFIG_PM
-static int snd_als4000_suspend(struct pci_dev *pci, pm_message_t state)
+static int snd_als4000_suspend(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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;
 
@@ -1001,13 +1002,14 @@ static int snd_als4000_suspend(struct pci_dev *pci, pm_message_t state)
 
        pci_disable_device(pci);
        pci_save_state(pci);
-       pci_set_power_state(pci, pci_choose_state(pci, state));
+       pci_set_power_state(pci, PCI_D3hot);
        return 0;
 }
 
-static int snd_als4000_resume(struct pci_dev *pci)
+static int snd_als4000_resume(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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;
 
@@ -1033,18 +1035,21 @@ static int snd_als4000_resume(struct pci_dev *pci)
        snd_power_change_state(card, SNDRV_CTL_POWER_D0);
        return 0;
 }
-#endif /* CONFIG_PM */
 
+static SIMPLE_DEV_PM_OPS(snd_als4000_pm, snd_als4000_suspend, snd_als4000_resume);
+#define SND_ALS4000_PM_OPS     &snd_als4000_pm
+#else
+#define SND_ALS4000_PM_OPS     NULL
+#endif /* CONFIG_PM */
 
 static struct pci_driver als4000_driver = {
        .name = KBUILD_MODNAME,
        .id_table = snd_als4000_ids,
        .probe = snd_card_als4000_probe,
        .remove = __devexit_p(snd_card_als4000_remove),
-#ifdef CONFIG_PM
-       .suspend = snd_als4000_suspend,
-       .resume = snd_als4000_resume,
-#endif
+       .driver = {
+               .pm = SND_ALS4000_PM_OPS,
+       },
 };
 
 module_pci_driver(als4000_driver);
index 156a94f8a1234aa6cbd8af5f8dd2e08a322b1172..31020d2a868bd97b92d18e65ceb469214f24f7f6 100644 (file)
@@ -1462,9 +1462,10 @@ static int __devinit snd_atiixp_mixer_new(struct atiixp *chip, int clock,
 /*
  * power management
  */
-static int snd_atiixp_suspend(struct pci_dev *pci, pm_message_t state)
+static int snd_atiixp_suspend(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       struct pci_dev *pci = to_pci_dev(dev);
+       struct snd_card *card = dev_get_drvdata(dev);
        struct atiixp *chip = card->private_data;
        int i;
 
@@ -1484,13 +1485,14 @@ static int snd_atiixp_suspend(struct pci_dev *pci, pm_message_t state)
 
        pci_disable_device(pci);
        pci_save_state(pci);
-       pci_set_power_state(pci, pci_choose_state(pci, state));
+       pci_set_power_state(pci, PCI_D3hot);
        return 0;
 }
 
-static int snd_atiixp_resume(struct pci_dev *pci)
+static int snd_atiixp_resume(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       struct pci_dev *pci = to_pci_dev(dev);
+       struct snd_card *card = dev_get_drvdata(dev);
        struct atiixp *chip = card->private_data;
        int i;
 
@@ -1526,6 +1528,11 @@ static int snd_atiixp_resume(struct pci_dev *pci)
        snd_power_change_state(card, SNDRV_CTL_POWER_D0);
        return 0;
 }
+
+static SIMPLE_DEV_PM_OPS(snd_atiixp_pm, snd_atiixp_suspend, snd_atiixp_resume);
+#define SND_ATIIXP_PM_OPS      &snd_atiixp_pm
+#else
+#define SND_ATIIXP_PM_OPS      NULL
 #endif /* CONFIG_PM */
 
 
@@ -1705,10 +1712,9 @@ static struct pci_driver atiixp_driver = {
        .id_table = snd_atiixp_ids,
        .probe = snd_atiixp_probe,
        .remove = __devexit_p(snd_atiixp_remove),
-#ifdef CONFIG_PM
-       .suspend = snd_atiixp_suspend,
-       .resume = snd_atiixp_resume,
-#endif
+       .driver = {
+               .pm = SND_ATIIXP_PM_OPS,
+       },
 };
 
 module_pci_driver(atiixp_driver);
index 30a4fd96ce739c937f52ecbe89d8ed3c2113248b..79e204ec623fe298859f216c85c36244ab81bf33 100644 (file)
@@ -1117,9 +1117,10 @@ static int __devinit snd_atiixp_mixer_new(struct atiixp_modem *chip, int clock)
 /*
  * power management
  */
-static int snd_atiixp_suspend(struct pci_dev *pci, pm_message_t state)
+static int snd_atiixp_suspend(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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;
 
@@ -1133,13 +1134,14 @@ static int snd_atiixp_suspend(struct pci_dev *pci, pm_message_t state)
 
        pci_disable_device(pci);
        pci_save_state(pci);
-       pci_set_power_state(pci, pci_choose_state(pci, state));
+       pci_set_power_state(pci, PCI_D3hot);
        return 0;
 }
 
-static int snd_atiixp_resume(struct pci_dev *pci)
+static int snd_atiixp_resume(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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;
 
@@ -1162,8 +1164,12 @@ static int snd_atiixp_resume(struct pci_dev *pci)
        snd_power_change_state(card, SNDRV_CTL_POWER_D0);
        return 0;
 }
-#endif /* CONFIG_PM */
 
+static SIMPLE_DEV_PM_OPS(snd_atiixp_pm, snd_atiixp_suspend, snd_atiixp_resume);
+#define SND_ATIIXP_PM_OPS      &snd_atiixp_pm
+#else
+#define SND_ATIIXP_PM_OPS      NULL
+#endif /* CONFIG_PM */
 
 #ifdef CONFIG_PROC_FS
 /*
@@ -1336,10 +1342,9 @@ static struct pci_driver atiixp_modem_driver = {
        .id_table = snd_atiixp_ids,
        .probe = snd_atiixp_probe,
        .remove = __devexit_p(snd_atiixp_remove),
-#ifdef CONFIG_PM
-       .suspend = snd_atiixp_suspend,
-       .resume = snd_atiixp_resume,
-#endif
+       .driver = {
+               .pm = SND_ATIIXP_PM_OPS,
+       },
 };
 
 module_pci_driver(atiixp_modem_driver);
index f0b4d7493af523083faa11422e5428d4b466bb7b..4dddd871548b3de1c83bb829c4c16bee7fa1a14e 100644 (file)
@@ -2794,9 +2794,10 @@ snd_azf3328_resume_ac97(const struct snd_azf3328 *chip)
 }
 
 static int
-snd_azf3328_suspend(struct pci_dev *pci, pm_message_t state)
+snd_azf3328_suspend(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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;
 
@@ -2824,14 +2825,15 @@ snd_azf3328_suspend(struct pci_dev *pci, pm_message_t state)
 
        pci_disable_device(pci);
        pci_save_state(pci);
-       pci_set_power_state(pci, pci_choose_state(pci, state));
+       pci_set_power_state(pci, PCI_D3hot);
        return 0;
 }
 
 static int
-snd_azf3328_resume(struct pci_dev *pci)
+snd_azf3328_resume(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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);
@@ -2859,18 +2861,21 @@ snd_azf3328_resume(struct pci_dev *pci)
        snd_power_change_state(card, SNDRV_CTL_POWER_D0);
        return 0;
 }
-#endif /* CONFIG_PM */
 
+static SIMPLE_DEV_PM_OPS(snd_azf3328_pm, snd_azf3328_suspend, snd_azf3328_resume);
+#define SND_AZF3328_PM_OPS     &snd_azf3328_pm
+#else
+#define SND_AZF3328_PM_OPS     NULL
+#endif /* CONFIG_PM */
 
 static struct pci_driver azf3328_driver = {
        .name = KBUILD_MODNAME,
        .id_table = snd_azf3328_ids,
        .probe = snd_azf3328_probe,
        .remove = __devexit_p(snd_azf3328_remove),
-#ifdef CONFIG_PM
-       .suspend = snd_azf3328_suspend,
-       .resume = snd_azf3328_resume,
-#endif
+       .driver = {
+               .pm = SND_AZF3328_PM_OPS,
+       },
 };
 
 module_pci_driver(azf3328_driver);
index e76d68a7081f7ec5795a4b0b6dc40b9e1564bd91..83277b747b36928f96ba14ab9bb0d32dcea1de57 100644 (file)
@@ -1872,9 +1872,10 @@ static void __devexit snd_ca0106_remove(struct pci_dev *pci)
 }
 
 #ifdef CONFIG_PM
-static int snd_ca0106_suspend(struct pci_dev *pci, pm_message_t state)
+static int snd_ca0106_suspend(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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;
 
@@ -1889,13 +1890,14 @@ static int snd_ca0106_suspend(struct pci_dev *pci, pm_message_t state)
 
        pci_disable_device(pci);
        pci_save_state(pci);
-       pci_set_power_state(pci, pci_choose_state(pci, state));
+       pci_set_power_state(pci, PCI_D3hot);
        return 0;
 }
 
-static int snd_ca0106_resume(struct pci_dev *pci)
+static int snd_ca0106_resume(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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;
 
@@ -1922,6 +1924,11 @@ static int snd_ca0106_resume(struct pci_dev *pci)
        snd_power_change_state(card, SNDRV_CTL_POWER_D0);
        return 0;
 }
+
+static SIMPLE_DEV_PM_OPS(snd_ca0106_pm, snd_ca0106_suspend, snd_ca0106_resume);
+#define SND_CA0106_PM_OPS      &snd_ca0106_pm
+#else
+#define SND_CA0106_PM_OPS      NULL
 #endif
 
 // PCI IDs
@@ -1937,10 +1944,9 @@ static struct pci_driver ca0106_driver = {
        .id_table = snd_ca0106_ids,
        .probe = snd_ca0106_probe,
        .remove = __devexit_p(snd_ca0106_remove),
-#ifdef CONFIG_PM
-       .suspend = snd_ca0106_suspend,
-       .resume = snd_ca0106_resume,
-#endif
+       .driver = {
+               .pm = SND_CA0106_PM_OPS,
+       },
 };
 
 module_pci_driver(ca0106_driver);
index 3815bd4c67790d009776856c9d5e5cf4a0de34cb..b7d6f2b886effc78de4da2caaeac53b1ff786010 100644 (file)
@@ -3338,9 +3338,10 @@ static unsigned char saved_mixers[] = {
        SB_DSP4_INPUT_LEFT, SB_DSP4_INPUT_RIGHT,
 };
 
-static int snd_cmipci_suspend(struct pci_dev *pci, pm_message_t state)
+static int snd_cmipci_suspend(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       struct pci_dev *pci = to_pci_dev(dev);
+       struct snd_card *card = dev_get_drvdata(dev);
        struct cmipci *cm = card->private_data;
        int i;
 
@@ -3361,13 +3362,14 @@ static int snd_cmipci_suspend(struct pci_dev *pci, pm_message_t state)
 
        pci_disable_device(pci);
        pci_save_state(pci);
-       pci_set_power_state(pci, pci_choose_state(pci, state));
+       pci_set_power_state(pci, PCI_D3hot);
        return 0;
 }
 
-static int snd_cmipci_resume(struct pci_dev *pci)
+static int snd_cmipci_resume(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       struct pci_dev *pci = to_pci_dev(dev);
+       struct snd_card *card = dev_get_drvdata(dev);
        struct cmipci *cm = card->private_data;
        int i;
 
@@ -3396,6 +3398,11 @@ static int snd_cmipci_resume(struct pci_dev *pci)
        snd_power_change_state(card, SNDRV_CTL_POWER_D0);
        return 0;
 }
+
+static SIMPLE_DEV_PM_OPS(snd_cmipci_pm, snd_cmipci_suspend, snd_cmipci_resume);
+#define SND_CMIPCI_PM_OPS      &snd_cmipci_pm
+#else
+#define SND_CMIPCI_PM_OPS      NULL
 #endif /* CONFIG_PM */
 
 static struct pci_driver cmipci_driver = {
@@ -3403,10 +3410,9 @@ static struct pci_driver cmipci_driver = {
        .id_table = snd_cmipci_ids,
        .probe = snd_cmipci_probe,
        .remove = __devexit_p(snd_cmipci_remove),
-#ifdef CONFIG_PM
-       .suspend = snd_cmipci_suspend,
-       .resume = snd_cmipci_resume,
-#endif
+       .driver = {
+               .pm = SND_CMIPCI_PM_OPS,
+       },
 };
        
 module_pci_driver(cmipci_driver);
index 33506ee569bd48c62411a1b014fbd5a28d69e26c..45a8317085f44961719db1b76195afb1d4d7e0ff 100644 (file)
@@ -1997,9 +1997,10 @@ static int saved_regs[SUSPEND_REGISTERS] = {
 
 #define CLKCR1_CKRA                             0x00010000L
 
-static int cs4281_suspend(struct pci_dev *pci, pm_message_t state)
+static int cs4281_suspend(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       struct pci_dev *pci = to_pci_dev(dev);
+       struct snd_card *card = dev_get_drvdata(dev);
        struct cs4281 *chip = card->private_data;
        u32 ulCLK;
        unsigned int i;
@@ -2040,13 +2041,14 @@ static int cs4281_suspend(struct pci_dev *pci, pm_message_t state)
 
        pci_disable_device(pci);
        pci_save_state(pci);
-       pci_set_power_state(pci, pci_choose_state(pci, state));
+       pci_set_power_state(pci, PCI_D3hot);
        return 0;
 }
 
-static int cs4281_resume(struct pci_dev *pci)
+static int cs4281_resume(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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;
@@ -2082,6 +2084,11 @@ static int cs4281_resume(struct pci_dev *pci)
        snd_power_change_state(card, SNDRV_CTL_POWER_D0);
        return 0;
 }
+
+static SIMPLE_DEV_PM_OPS(cs4281_pm, cs4281_suspend, cs4281_resume);
+#define CS4281_PM_OPS  &cs4281_pm
+#else
+#define CS4281_PM_OPS  NULL
 #endif /* CONFIG_PM */
 
 static struct pci_driver cs4281_driver = {
@@ -2089,10 +2096,9 @@ static struct pci_driver cs4281_driver = {
        .id_table = snd_cs4281_ids,
        .probe = snd_cs4281_probe,
        .remove = __devexit_p(snd_cs4281_remove),
-#ifdef CONFIG_PM
-       .suspend = cs4281_suspend,
-       .resume = cs4281_resume,
-#endif
+       .driver = {
+               .pm = CS4281_PM_OPS,
+       },
 };
        
 module_pci_driver(cs4281_driver);
index 6cc7404e0e8f62991120eb5a86f835017c84cdf3..00e03bc9a762e21356e561bb94b586b9d7dd2648 100644 (file)
@@ -167,8 +167,9 @@ static struct pci_driver cs46xx_driver = {
        .probe = snd_card_cs46xx_probe,
        .remove = __devexit_p(snd_card_cs46xx_remove),
 #ifdef CONFIG_PM
-       .suspend = snd_cs46xx_suspend,
-       .resume = snd_cs46xx_resume,
+       .driver = {
+               .pm = &snd_cs46xx_pm,
+       },
 #endif
 };
 
index 4fa53161b0944fd6b308fcc928e73db1d628e718..28b9747becc947f06f1fe3c597848588e980ef07 100644 (file)
@@ -3599,9 +3599,10 @@ static unsigned int saved_regs[] = {
        BA1_CVOL,
 };
 
-int snd_cs46xx_suspend(struct pci_dev *pci, pm_message_t state)
+static int snd_cs46xx_suspend(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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;
 
@@ -3628,13 +3629,14 @@ int snd_cs46xx_suspend(struct pci_dev *pci, pm_message_t state)
 
        pci_disable_device(pci);
        pci_save_state(pci);
-       pci_set_power_state(pci, pci_choose_state(pci, state));
+       pci_set_power_state(pci, PCI_D3hot);
        return 0;
 }
 
-int snd_cs46xx_resume(struct pci_dev *pci)
+static int snd_cs46xx_resume(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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;
 #ifdef CONFIG_SND_CS46XX_NEW_DSP
@@ -3707,6 +3709,8 @@ int snd_cs46xx_resume(struct pci_dev *pci)
        snd_power_change_state(card, SNDRV_CTL_POWER_D0);
        return 0;
 }
+
+SIMPLE_DEV_PM_OPS(snd_cs46xx_pm, snd_cs46xx_suspend, snd_cs46xx_resume);
 #endif /* CONFIG_PM */
 
 
index 2c9697cf0a1a7c2f3e4dc650b9f505522e69afa2..51f64ba5facf0ace8ec14e85ef4eb6911100f9d9 100644 (file)
@@ -400,8 +400,9 @@ static struct pci_driver cs5535audio_driver = {
        .probe = snd_cs5535audio_probe,
        .remove = __devexit_p(snd_cs5535audio_remove),
 #ifdef CONFIG_PM
-       .suspend = snd_cs5535audio_suspend,
-       .resume = snd_cs5535audio_resume,
+       .driver = {
+               .pm = &snd_cs5535audio_pm,
+       },
 #endif
 };
 
index 51966d782a3cb45f02a4186b726f8cdcbc42df40..bb3cc641130c68ef6d9ce2c51f070abfc1de9e3f 100644 (file)
@@ -94,10 +94,7 @@ struct cs5535audio {
        struct cs5535audio_dma dmas[NUM_CS5535AUDIO_DMAS];
 };
 
-#ifdef CONFIG_PM
-int snd_cs5535audio_suspend(struct pci_dev *pci, pm_message_t state);
-int snd_cs5535audio_resume(struct pci_dev *pci);
-#endif
+extern const struct dev_pm_ops snd_cs5535audio_pm;
 
 #ifdef CONFIG_OLPC
 void __devinit olpc_prequirks(struct snd_card *card,
index 185b00088320415191dafec55a5611dd3eaa5bb5..6c34def5986d76415eb87f07c227b694dc0005c4 100644 (file)
@@ -55,9 +55,10 @@ static void snd_cs5535audio_stop_hardware(struct cs5535audio *cs5535au)
 
 }
 
-int snd_cs5535audio_suspend(struct pci_dev *pci, pm_message_t state)
+static int snd_cs5535audio_suspend(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       struct pci_dev *pci = to_pci_dev(dev);
+       struct snd_card *card = dev_get_drvdata(dev);
        struct cs5535audio *cs5535au = card->private_data;
        int i;
 
@@ -77,13 +78,14 @@ int snd_cs5535audio_suspend(struct pci_dev *pci, pm_message_t state)
                return -EIO;
        }
        pci_disable_device(pci);
-       pci_set_power_state(pci, pci_choose_state(pci, state));
+       pci_set_power_state(pci, PCI_D3hot);
        return 0;
 }
 
-int snd_cs5535audio_resume(struct pci_dev *pci)
+static int snd_cs5535audio_resume(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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;
@@ -129,3 +131,4 @@ int snd_cs5535audio_resume(struct pci_dev *pci)
        return 0;
 }
 
+SIMPLE_DEV_PM_OPS(snd_cs5535audio_pm, snd_cs5535audio_suspend, snd_cs5535audio_resume);
index d8a4423539cecd850a88dfccbc001677400730a2..8e40262d4117cf923c9972711177ab5b8b445dcd 100644 (file)
@@ -1537,7 +1537,7 @@ static void atc_connect_resources(struct ct_atc *atc)
 }
 
 #ifdef CONFIG_PM
-static int atc_suspend(struct ct_atc *atc, pm_message_t state)
+static int atc_suspend(struct ct_atc *atc)
 {
        int i;
        struct hw *hw = atc->hw;
@@ -1553,7 +1553,7 @@ static int atc_suspend(struct ct_atc *atc, pm_message_t state)
 
        atc_release_resources(atc);
 
-       hw->suspend(hw, state);
+       hw->suspend(hw);
 
        return 0;
 }
index 3a0def656af05c6b7870ceb375c2fffa299d7248..653e813ad1422729ce69c26df8a81b721c095387 100644 (file)
@@ -144,7 +144,7 @@ struct ct_atc {
        struct ct_timer *timer;
 
 #ifdef CONFIG_PM
-       int (*suspend)(struct ct_atc *atc, pm_message_t state);
+       int (*suspend)(struct ct_atc *atc);
        int (*resume)(struct ct_atc *atc);
 #define NUM_PCMS (NUM_CTALSADEVS - 1)
        struct snd_pcm *pcms[NUM_PCMS];
index 908315bec3b49185bfa0786afa9870a1f1e7c4c8..c56fe533b3f375b643988e9d1b9b40f783fa6385 100644 (file)
@@ -73,7 +73,7 @@ struct hw {
        int (*card_stop)(struct hw *hw);
        int (*pll_init)(struct hw *hw, unsigned int rsr);
 #ifdef CONFIG_PM
-       int (*suspend)(struct hw *hw, pm_message_t state);
+       int (*suspend)(struct hw *hw);
        int (*resume)(struct hw *hw, struct card_conf *info);
 #endif
        int (*is_adc_source_selected)(struct hw *hw, enum ADCSRC source);
index a7df19791f5acb60c6ddc7d28201162bebe17fdc..dc1969bc67d4982d187cb095ad29d6f61b132607 100644 (file)
@@ -2086,7 +2086,7 @@ static int hw_card_init(struct hw *hw, struct card_conf *info)
 }
 
 #ifdef CONFIG_PM
-static int hw_suspend(struct hw *hw, pm_message_t state)
+static int hw_suspend(struct hw *hw)
 {
        struct pci_dev *pci = hw->pci;
 
@@ -2099,7 +2099,7 @@ static int hw_suspend(struct hw *hw, pm_message_t state)
 
        pci_disable_device(pci);
        pci_save_state(pci);
-       pci_set_power_state(pci, pci_choose_state(pci, state));
+       pci_set_power_state(pci, PCI_D3hot);
 
        return 0;
 }
index d6c54b524bfa63a9b9ed46c6eeb337848b541185..9d1231dc4ae22d8a5041bd3722fd406f55d95a58 100644 (file)
@@ -2202,7 +2202,7 @@ static int hw_card_init(struct hw *hw, struct card_conf *info)
 }
 
 #ifdef CONFIG_PM
-static int hw_suspend(struct hw *hw, pm_message_t state)
+static int hw_suspend(struct hw *hw)
 {
        struct pci_dev *pci = hw->pci;
 
@@ -2210,7 +2210,7 @@ static int hw_suspend(struct hw *hw, pm_message_t state)
 
        pci_disable_device(pci);
        pci_save_state(pci);
-       pci_set_power_state(pci, pci_choose_state(pci, state));
+       pci_set_power_state(pci, PCI_D3hot);
 
        return 0;
 }
index 75aa2c3384108c414d89d169a4a4bf8a0b8cbf7b..e002183ef8b2a7f0c5cd8a542d58340020299beb 100644 (file)
@@ -126,21 +126,26 @@ static void __devexit ct_card_remove(struct pci_dev *pci)
 }
 
 #ifdef CONFIG_PM
-static int ct_card_suspend(struct pci_dev *pci, pm_message_t state)
+static int ct_card_suspend(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       struct snd_card *card = dev_get_drvdata(dev);
        struct ct_atc *atc = card->private_data;
 
-       return atc->suspend(atc, state);
+       return atc->suspend(atc);
 }
 
-static int ct_card_resume(struct pci_dev *pci)
+static int ct_card_resume(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       struct snd_card *card = dev_get_drvdata(dev);
        struct ct_atc *atc = card->private_data;
 
        return atc->resume(atc);
 }
+
+static SIMPLE_DEV_PM_OPS(ct_card_pm, ct_card_suspend, ct_card_resume);
+#define CT_CARD_PM_OPS &ct_card_pm
+#else
+#define CT_CARD_PM_OPS NULL
 #endif
 
 static struct pci_driver ct_driver = {
@@ -148,10 +153,9 @@ static struct pci_driver ct_driver = {
        .id_table = ct_pci_dev_ids,
        .probe = ct_card_probe,
        .remove = __devexit_p(ct_card_remove),
-#ifdef CONFIG_PM
-       .suspend = ct_card_suspend,
-       .resume = ct_card_resume,
-#endif
+       .driver = {
+               .pm = CT_CARD_PM_OPS,
+       },
 };
 
 module_pci_driver(ct_driver);
index 0f8eda1dafdbb8ac11f5e570cda74c5b2373463d..0ff754f180d0e852e55c74b2454d1ca00dba21d6 100644 (file)
@@ -2205,9 +2205,10 @@ ctl_error:
 
 #if defined(CONFIG_PM)
 
-static int snd_echo_suspend(struct pci_dev *pci, pm_message_t state)
+static int snd_echo_suspend(struct device *dev)
 {
-       struct echoaudio *chip = pci_get_drvdata(pci);
+       struct pci_dev *pci = to_pci_dev(dev);
+       struct echoaudio *chip = dev_get_drvdata(dev);
 
        DE_INIT(("suspend start\n"));
        snd_pcm_suspend_all(chip->analog_pcm);
@@ -2242,9 +2243,10 @@ static int snd_echo_suspend(struct pci_dev *pci, pm_message_t state)
 
 
 
-static int snd_echo_resume(struct pci_dev *pci)
+static int snd_echo_resume(struct device *dev)
 {
-       struct echoaudio *chip = pci_get_drvdata(pci);
+       struct pci_dev *pci = to_pci_dev(dev);
+       struct echoaudio *chip = dev_get_drvdata(dev);
        struct comm_page *commpage, *commpage_bak;
        u32 pipe_alloc_mask;
        int err;
@@ -2307,10 +2309,13 @@ static int snd_echo_resume(struct pci_dev *pci)
        return 0;
 }
 
+static SIMPLE_DEV_PM_OPS(snd_echo_pm, snd_echo_suspend, snd_echo_resume);
+#define SND_ECHO_PM_OPS        &snd_echo_pm
+#else
+#define SND_ECHO_PM_OPS        NULL
 #endif /* CONFIG_PM */
 
 
-
 static void __devexit snd_echo_remove(struct pci_dev *pci)
 {
        struct echoaudio *chip;
@@ -2333,10 +2338,9 @@ static struct pci_driver echo_driver = {
        .id_table = snd_echo_ids,
        .probe = snd_echo_probe,
        .remove = __devexit_p(snd_echo_remove),
-#ifdef CONFIG_PM
-       .suspend = snd_echo_suspend,
-       .resume = snd_echo_resume,
-#endif /* CONFIG_PM */
+       .driver = {
+               .pm = SND_ECHO_PM_OPS,
+       },
 };
 
 module_pci_driver(echo_driver);
index 7fdbbe4d9965385be9f12aa1db0fb011b1de946b..ddac4e6d660d0116f27af2ebf4f70344b63b932d 100644 (file)
@@ -207,9 +207,10 @@ static void __devexit snd_card_emu10k1_remove(struct pci_dev *pci)
 
 
 #ifdef CONFIG_PM
-static int snd_emu10k1_suspend(struct pci_dev *pci, pm_message_t state)
+static int snd_emu10k1_suspend(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       struct pci_dev *pci = to_pci_dev(dev);
+       struct snd_card *card = dev_get_drvdata(dev);
        struct snd_emu10k1 *emu = card->private_data;
 
        snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
@@ -231,13 +232,14 @@ static int snd_emu10k1_suspend(struct pci_dev *pci, pm_message_t state)
 
        pci_disable_device(pci);
        pci_save_state(pci);
-       pci_set_power_state(pci, pci_choose_state(pci, state));
+       pci_set_power_state(pci, PCI_D3hot);
        return 0;
 }
 
-static int snd_emu10k1_resume(struct pci_dev *pci)
+static int snd_emu10k1_resume(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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);
@@ -261,17 +263,21 @@ static int snd_emu10k1_resume(struct pci_dev *pci)
        snd_power_change_state(card, SNDRV_CTL_POWER_D0);
        return 0;
 }
-#endif
+
+static SIMPLE_DEV_PM_OPS(snd_emu10k1_pm, snd_emu10k1_suspend, snd_emu10k1_resume);
+#define SND_EMU10K1_PM_OPS     &snd_emu10k1_pm
+#else
+#define SND_EMU10K1_PM_OPS     NULL
+#endif /* CONFIG_PM */
 
 static struct pci_driver emu10k1_driver = {
        .name = KBUILD_MODNAME,
        .id_table = snd_emu10k1_ids,
        .probe = snd_card_emu10k1_probe,
        .remove = __devexit_p(snd_card_emu10k1_remove),
-#ifdef CONFIG_PM
-       .suspend = snd_emu10k1_suspend,
-       .resume = snd_emu10k1_resume,
-#endif
+       .driver = {
+               .pm = SND_EMU10K1_PM_OPS,
+       },
 };
 
 module_pci_driver(emu10k1_driver);
index 3821c81d1c993a24961aa4d416d70c8bbc6cd480..f7e6f73186e18a99a7e25b5e5d4c5639f3032af6 100644 (file)
@@ -2033,9 +2033,10 @@ static void snd_ensoniq_chip_init(struct ensoniq *ensoniq)
 }
 
 #ifdef CONFIG_PM
-static int snd_ensoniq_suspend(struct pci_dev *pci, pm_message_t state)
+static int snd_ensoniq_suspend(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       struct pci_dev *pci = to_pci_dev(dev);
+       struct snd_card *card = dev_get_drvdata(dev);
        struct ensoniq *ensoniq = card->private_data;
        
        snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
@@ -2058,13 +2059,14 @@ static int snd_ensoniq_suspend(struct pci_dev *pci, pm_message_t state)
 
        pci_disable_device(pci);
        pci_save_state(pci);
-       pci_set_power_state(pci, pci_choose_state(pci, state));
+       pci_set_power_state(pci, PCI_D3hot);
        return 0;
 }
 
-static int snd_ensoniq_resume(struct pci_dev *pci)
+static int snd_ensoniq_resume(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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);
@@ -2087,8 +2089,12 @@ static int snd_ensoniq_resume(struct pci_dev *pci)
        snd_power_change_state(card, SNDRV_CTL_POWER_D0);
        return 0;
 }
-#endif /* CONFIG_PM */
 
+static SIMPLE_DEV_PM_OPS(snd_ensoniq_pm, snd_ensoniq_suspend, snd_ensoniq_resume);
+#define SND_ENSONIQ_PM_OPS     &snd_ensoniq_pm
+#else
+#define SND_ENSONIQ_PM_OPS     NULL
+#endif /* CONFIG_PM */
 
 static int __devinit snd_ensoniq_create(struct snd_card *card,
                                     struct pci_dev *pci,
@@ -2493,10 +2499,9 @@ static struct pci_driver ens137x_driver = {
        .id_table = snd_audiopci_ids,
        .probe = snd_audiopci_probe,
        .remove = __devexit_p(snd_audiopci_remove),
-#ifdef CONFIG_PM
-       .suspend = snd_ensoniq_suspend,
-       .resume = snd_ensoniq_resume,
-#endif
+       .driver = {
+               .pm = SND_ENSONIQ_PM_OPS,
+       },
 };
        
 module_pci_driver(ens137x_driver);
index 82c8d8c5c52ae724657c9bd7212fddc333d4cd5e..227dff70069f3f8777e7855b582fa2e5ac01cf03 100644 (file)
@@ -1474,9 +1474,10 @@ static unsigned char saved_regs[SAVED_REG_SIZE+1] = {
 };
 
 
-static int es1938_suspend(struct pci_dev *pci, pm_message_t state)
+static int es1938_suspend(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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;
 
@@ -1494,13 +1495,14 @@ static int es1938_suspend(struct pci_dev *pci, pm_message_t state)
        }
        pci_disable_device(pci);
        pci_save_state(pci);
-       pci_set_power_state(pci, pci_choose_state(pci, state));
+       pci_set_power_state(pci, PCI_D3hot);
        return 0;
 }
 
-static int es1938_resume(struct pci_dev *pci)
+static int es1938_resume(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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;
 
@@ -1534,6 +1536,11 @@ static int es1938_resume(struct pci_dev *pci)
        snd_power_change_state(card, SNDRV_CTL_POWER_D0);
        return 0;
 }
+
+static SIMPLE_DEV_PM_OPS(es1938_pm, es1938_suspend, es1938_resume);
+#define ES1938_PM_OPS  &es1938_pm
+#else
+#define ES1938_PM_OPS  NULL
 #endif /* CONFIG_PM */
 
 #ifdef SUPPORT_JOYSTICK
@@ -1887,10 +1894,9 @@ static struct pci_driver es1938_driver = {
        .id_table = snd_es1938_ids,
        .probe = snd_es1938_probe,
        .remove = __devexit_p(snd_es1938_remove),
-#ifdef CONFIG_PM
-       .suspend = es1938_suspend,
-       .resume = es1938_resume,
-#endif
+       .driver = {
+               .pm = ES1938_PM_OPS,
+       },
 };
 
 module_pci_driver(es1938_driver);
index 52b5c0bf90c12a640b02deb844c58c0254a8c73c..fb4c90b99c003c4c673c00bc67c5442f058541d7 100644 (file)
@@ -2381,9 +2381,10 @@ static void snd_es1968_start_irq(struct es1968 *chip)
 /*
  * PM support
  */
-static int es1968_suspend(struct pci_dev *pci, pm_message_t state)
+static int es1968_suspend(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       struct pci_dev *pci = to_pci_dev(dev);
+       struct snd_card *card = dev_get_drvdata(dev);
        struct es1968 *chip = card->private_data;
 
        if (! chip->do_pm)
@@ -2398,13 +2399,14 @@ static int es1968_suspend(struct pci_dev *pci, pm_message_t state)
 
        pci_disable_device(pci);
        pci_save_state(pci);
-       pci_set_power_state(pci, pci_choose_state(pci, state));
+       pci_set_power_state(pci, PCI_D3hot);
        return 0;
 }
 
-static int es1968_resume(struct pci_dev *pci)
+static int es1968_resume(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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;
 
@@ -2454,6 +2456,11 @@ static int es1968_resume(struct pci_dev *pci)
        chip->in_suspend = 0;
        return 0;
 }
+
+static SIMPLE_DEV_PM_OPS(es1968_pm, es1968_suspend, es1968_resume);
+#define ES1968_PM_OPS  &es1968_pm
+#else
+#define ES1968_PM_OPS  NULL
 #endif /* CONFIG_PM */
 
 #ifdef SUPPORT_JOYSTICK
@@ -2903,10 +2910,9 @@ static struct pci_driver es1968_driver = {
        .id_table = snd_es1968_ids,
        .probe = snd_es1968_probe,
        .remove = __devexit_p(snd_es1968_remove),
-#ifdef CONFIG_PM
-       .suspend = es1968_suspend,
-       .resume = es1968_resume,
-#endif
+       .driver = {
+               .pm = ES1968_PM_OPS,
+       },
 };
 
 module_pci_driver(es1968_driver);
index b32e8024ea86c017812fc517c6d246daec475c73..522c8706f24446e5cb70f2522284d37d7ef14213 100644 (file)
@@ -1369,9 +1369,10 @@ static unsigned char saved_regs[] = {
        FM801_CODEC_CTRL, FM801_I2S_MODE, FM801_VOLUME, FM801_GEN_CTRL,
 };
 
-static int snd_fm801_suspend(struct pci_dev *pci, pm_message_t state)
+static int snd_fm801_suspend(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       struct pci_dev *pci = to_pci_dev(dev);
+       struct snd_card *card = dev_get_drvdata(dev);
        struct fm801 *chip = card->private_data;
        int i;
 
@@ -1385,13 +1386,14 @@ static int snd_fm801_suspend(struct pci_dev *pci, pm_message_t state)
 
        pci_disable_device(pci);
        pci_save_state(pci);
-       pci_set_power_state(pci, pci_choose_state(pci, state));
+       pci_set_power_state(pci, PCI_D3hot);
        return 0;
 }
 
-static int snd_fm801_resume(struct pci_dev *pci)
+static int snd_fm801_resume(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       struct pci_dev *pci = to_pci_dev(dev);
+       struct snd_card *card = dev_get_drvdata(dev);
        struct fm801 *chip = card->private_data;
        int i;
 
@@ -1414,17 +1416,21 @@ static int snd_fm801_resume(struct pci_dev *pci)
        snd_power_change_state(card, SNDRV_CTL_POWER_D0);
        return 0;
 }
-#endif
+
+static SIMPLE_DEV_PM_OPS(snd_fm801_pm, snd_fm801_suspend, snd_fm801_resume);
+#define SND_FM801_PM_OPS       &snd_fm801_pm
+#else
+#define SND_FM801_PM_OPS       NULL
+#endif /* CONFIG_PM */
 
 static struct pci_driver fm801_driver = {
        .name = KBUILD_MODNAME,
        .id_table = snd_fm801_ids,
        .probe = snd_card_fm801_probe,
        .remove = __devexit_p(snd_card_fm801_remove),
-#ifdef CONFIG_PM
-       .suspend = snd_fm801_suspend,
-       .resume = snd_fm801_resume,
-#endif
+       .driver = {
+               .pm = SND_FM801_PM_OPS,
+       },
 };
 
 module_pci_driver(fm801_driver);
index 51cb2a2e4fce03fbfdce96fb4b2c1b23063d45ed..f4c274c5144bf7286accafee0d8d39de6f95629e 100644 (file)
@@ -3545,7 +3545,7 @@ static inline void hda_exec_init_verbs(struct hda_codec *codec) {}
 static void hda_call_codec_suspend(struct hda_codec *codec)
 {
        if (codec->patch_ops.suspend)
-               codec->patch_ops.suspend(codec, PMSG_SUSPEND);
+               codec->patch_ops.suspend(codec);
        hda_cleanup_all_streams(codec);
        hda_set_power_state(codec,
                            codec->afg ? codec->afg : codec->mfg,
index 2fdaadbb4326fad36863fa1c5f1373464614ab88..5aab408dcb6a04b007f9e3b33a35926080e6d90a 100644 (file)
@@ -703,7 +703,7 @@ struct hda_codec_ops {
        void (*set_power_state)(struct hda_codec *codec, hda_nid_t fg,
                                unsigned int power_state);
 #ifdef CONFIG_PM
-       int (*suspend)(struct hda_codec *codec, pm_message_t state);
+       int (*suspend)(struct hda_codec *codec);
        int (*resume)(struct hda_codec *codec);
 #endif
 #ifdef CONFIG_SND_HDA_POWER_SAVE
index 7757536b9d5faccfdd33d5ff2ece304d4282a2d0..a69ec74487141b3d080fc814cf662d03f152bcf7 100644 (file)
@@ -2403,9 +2403,10 @@ static void azx_power_notify(struct hda_bus *bus)
  * power management
  */
 
-static int azx_suspend(struct pci_dev *pci, pm_message_t state)
+static int azx_suspend(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       struct pci_dev *pci = to_pci_dev(dev);
+       struct snd_card *card = dev_get_drvdata(dev);
        struct azx *chip = card->private_data;
        struct azx_pcm *p;
 
@@ -2424,13 +2425,14 @@ static int azx_suspend(struct pci_dev *pci, pm_message_t state)
                pci_disable_msi(chip->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_D3hot);
        return 0;
 }
 
-static int azx_resume(struct pci_dev *pci)
+static int azx_resume(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       struct pci_dev *pci = to_pci_dev(dev);
+       struct snd_card *card = dev_get_drvdata(dev);
        struct azx *chip = card->private_data;
 
        pci_set_power_state(pci, PCI_D0);
@@ -2455,6 +2457,12 @@ static int azx_resume(struct pci_dev *pci)
        snd_power_change_state(card, SNDRV_CTL_POWER_D0);
        return 0;
 }
+static SIMPLE_DEV_PM_OPS(azx_pm, azx_suspend, azx_resume);
+#define AZX_PM_OPS     &azx_pm
+#else
+#define azx_suspend(dev)
+#define azx_resume(dev)
+#define AZX_PM_OPS     NULL
 #endif /* CONFIG_PM */
 
 
@@ -2521,13 +2529,13 @@ static void azx_vs_set_state(struct pci_dev *pci,
                           disabled ? "Disabling" : "Enabling",
                           pci_name(chip->pci));
                if (disabled) {
-                       azx_suspend(pci, PMSG_FREEZE);
+                       azx_suspend(&pci->dev);
                        chip->disabled = true;
                        snd_hda_lock_devices(chip->bus);
                } else {
                        snd_hda_unlock_devices(chip->bus);
                        chip->disabled = false;
-                       azx_resume(pci);
+                       azx_resume(&pci->dev);
                }
        }
 }
@@ -3398,10 +3406,9 @@ static struct pci_driver azx_driver = {
        .id_table = azx_ids,
        .probe = azx_probe,
        .remove = __devexit_p(azx_remove),
-#ifdef CONFIG_PM
-       .suspend = azx_suspend,
-       .resume = azx_resume,
-#endif
+       .driver = {
+               .pm = AZX_PM_OPS,
+       },
 };
 
 module_pci_driver(azx_driver);
index d8b2d6dee986b928ae0ffe98509a167e07ba639f..0208fa121e5aad0fa4c77f6d5a642aebb38417dd 100644 (file)
@@ -642,7 +642,7 @@ static void ad198x_free(struct hda_codec *codec)
 }
 
 #ifdef CONFIG_PM
-static int ad198x_suspend(struct hda_codec *codec, pm_message_t state)
+static int ad198x_suspend(struct hda_codec *codec)
 {
        ad198x_shutup(codec);
        return 0;
index 9647ed4d7929175452ea77eee81677342264104f..0c4c1a61b3789f590d62ea6a2e8348417746cd95 100644 (file)
@@ -1892,7 +1892,7 @@ static int cs421x_parse_auto_config(struct hda_codec *codec)
        Manage PDREF, when transitioning to D3hot
        (DAC,ADC) -> D3, PDREF=1, AFG->D3
 */
-static int cs421x_suspend(struct hda_codec *codec, pm_message_t state)
+static int cs421x_suspend(struct hda_codec *codec)
 {
        struct cs_spec *spec = codec->spec;
        unsigned int coef;
index 2bf99fc1cbf243a78d06b711df3e9852d5882998..14361184ae1e0e17ac2483dcac3c525289369f1f 100644 (file)
@@ -554,7 +554,7 @@ static int conexant_build_controls(struct hda_codec *codec)
 }
 
 #ifdef CONFIG_SND_HDA_POWER_SAVE
-static int conexant_suspend(struct hda_codec *codec, pm_message_t state)
+static int conexant_suspend(struct hda_codec *codec)
 {
        snd_hda_shutup_pins(codec);
        return 0;
index 5ccf10a4d5932b187bba679e40e8f424d4739551..ab2c729b88ea0ec729b316333f42e5925ecfd575 100644 (file)
@@ -2300,7 +2300,7 @@ static void alc_power_eapd(struct hda_codec *codec)
        alc_auto_setup_eapd(codec, false);
 }
 
-static int alc_suspend(struct hda_codec *codec, pm_message_t state)
+static int alc_suspend(struct hda_codec *codec)
 {
        struct alc_spec *spec = codec->spec;
        alc_shutup(codec);
index 07675282015a5a87a7572b4bb632abae1684e0e9..a1596a3b171c67683d900ebe9ec7da27f3236a97 100644 (file)
@@ -4997,7 +4997,7 @@ static int stac92xx_resume(struct hda_codec *codec)
        return 0;
 }
 
-static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state)
+static int stac92xx_suspend(struct hda_codec *codec)
 {
        stac92xx_shutup(codec);
        return 0;
index 82b368068e08a57eb2785ca1dea23ca420b152e9..90645560ed3981c5648bc35b0907ecd829a1e62c 100644 (file)
@@ -1748,7 +1748,7 @@ static void via_unsol_event(struct hda_codec *codec,
 }
 
 #ifdef CONFIG_PM
-static int via_suspend(struct hda_codec *codec, pm_message_t state)
+static int via_suspend(struct hda_codec *codec)
 {
        struct via_spec *spec = codec->spec;
        vt1708_stop_hp_work(spec);
index a01a00d1cf4db3ab1184beba254a3f20cb4e3634..bed9f34f4efee6b9556dbe23cf675242cbf7c0b4 100644 (file)
@@ -2793,9 +2793,10 @@ static void __devexit snd_vt1724_remove(struct pci_dev *pci)
 }
 
 #ifdef CONFIG_PM
-static int snd_vt1724_suspend(struct pci_dev *pci, pm_message_t state)
+static int snd_vt1724_suspend(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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)
@@ -2820,13 +2821,14 @@ static int snd_vt1724_suspend(struct pci_dev *pci, pm_message_t state)
 
        pci_disable_device(pci);
        pci_save_state(pci);
-       pci_set_power_state(pci, pci_choose_state(pci, state));
+       pci_set_power_state(pci, PCI_D3hot);
        return 0;
 }
 
-static int snd_vt1724_resume(struct pci_dev *pci)
+static int snd_vt1724_resume(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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)
@@ -2871,17 +2873,21 @@ static int snd_vt1724_resume(struct pci_dev *pci)
        snd_power_change_state(card, SNDRV_CTL_POWER_D0);
        return 0;
 }
-#endif
+
+static SIMPLE_DEV_PM_OPS(snd_vt1724_pm, snd_vt1724_suspend, snd_vt1724_resume);
+#define SND_VT1724_PM_OPS      &snd_vt1724_pm
+#else
+#define SND_VT1724_PM_OPS      NULL
+#endif /* CONFIG_PM */
 
 static struct pci_driver vt1724_driver = {
        .name = KBUILD_MODNAME,
        .id_table = snd_vt1724_ids,
        .probe = snd_vt1724_probe,
        .remove = __devexit_p(snd_vt1724_remove),
-#ifdef CONFIG_PM
-       .suspend = snd_vt1724_suspend,
-       .resume = snd_vt1724_resume,
-#endif
+       .driver = {
+               .pm = SND_VT1724_PM_OPS,
+       },
 };
 
 module_pci_driver(vt1724_driver);
index f4e2dd4da8cf6e2c5e72b45d88e143a9d19783bb..cd553f592e2d12643558958b14693ccd87a6ac07 100644 (file)
@@ -2624,9 +2624,10 @@ static int snd_intel8x0_free(struct intel8x0 *chip)
 /*
  * power management
  */
-static int intel8x0_suspend(struct pci_dev *pci, pm_message_t state)
+static int intel8x0_suspend(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       struct pci_dev *pci = to_pci_dev(dev);
+       struct snd_card *card = dev_get_drvdata(dev);
        struct intel8x0 *chip = card->private_data;
        int i;
 
@@ -2658,13 +2659,14 @@ static int intel8x0_suspend(struct pci_dev *pci, pm_message_t state)
        /* The call below may disable built-in speaker on some laptops
         * after S2RAM.  So, don't touch it.
         */
-       /* pci_set_power_state(pci, pci_choose_state(pci, state)); */
+       /* pci_set_power_state(pci, PCI_D3hot); */
        return 0;
 }
 
-static int intel8x0_resume(struct pci_dev *pci)
+static int intel8x0_resume(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       struct pci_dev *pci = to_pci_dev(dev);
+       struct snd_card *card = dev_get_drvdata(dev);
        struct intel8x0 *chip = card->private_data;
        int i;
 
@@ -2734,6 +2736,11 @@ static int intel8x0_resume(struct pci_dev *pci)
        snd_power_change_state(card, SNDRV_CTL_POWER_D0);
        return 0;
 }
+
+static SIMPLE_DEV_PM_OPS(intel8x0_pm, intel8x0_suspend, intel8x0_resume);
+#define INTEL8X0_PM_OPS        &intel8x0_pm
+#else
+#define INTEL8X0_PM_OPS        NULL
 #endif /* CONFIG_PM */
 
 #define INTEL8X0_TESTBUF_SIZE  32768   /* enough large for one shot */
@@ -3343,10 +3350,9 @@ static struct pci_driver intel8x0_driver = {
        .id_table = snd_intel8x0_ids,
        .probe = snd_intel8x0_probe,
        .remove = __devexit_p(snd_intel8x0_remove),
-#ifdef CONFIG_PM
-       .suspend = intel8x0_suspend,
-       .resume = intel8x0_resume,
-#endif
+       .driver = {
+               .pm = INTEL8X0_PM_OPS,
+       },
 };
 
 module_pci_driver(intel8x0_driver);
index fc27a6a69e77d8aeb45a9a46fda2d319fa1c19fc..da44bb3f8e7aaf1c8c7ca35278d27c275010365c 100644 (file)
@@ -1012,9 +1012,10 @@ static int snd_intel8x0m_free(struct intel8x0m *chip)
 /*
  * power management
  */
-static int intel8x0m_suspend(struct pci_dev *pci, pm_message_t state)
+static int intel8x0m_suspend(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       struct pci_dev *pci = to_pci_dev(dev);
+       struct snd_card *card = dev_get_drvdata(dev);
        struct intel8x0m *chip = card->private_data;
        int i;
 
@@ -1028,13 +1029,14 @@ static int intel8x0m_suspend(struct pci_dev *pci, pm_message_t state)
        }
        pci_disable_device(pci);
        pci_save_state(pci);
-       pci_set_power_state(pci, pci_choose_state(pci, state));
+       pci_set_power_state(pci, PCI_D3hot);
        return 0;
 }
 
-static int intel8x0m_resume(struct pci_dev *pci)
+static int intel8x0m_resume(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       struct pci_dev *pci = to_pci_dev(dev);
+       struct snd_card *card = dev_get_drvdata(dev);
        struct intel8x0m *chip = card->private_data;
 
        pci_set_power_state(pci, PCI_D0);
@@ -1060,6 +1062,11 @@ static int intel8x0m_resume(struct pci_dev *pci)
        snd_power_change_state(card, SNDRV_CTL_POWER_D0);
        return 0;
 }
+
+static SIMPLE_DEV_PM_OPS(intel8x0m_pm, intel8x0m_suspend, intel8x0m_resume);
+#define INTEL8X0M_PM_OPS       &intel8x0m_pm
+#else
+#define INTEL8X0M_PM_OPS       NULL
 #endif /* CONFIG_PM */
 
 #ifdef CONFIG_PROC_FS
@@ -1329,10 +1336,9 @@ static struct pci_driver intel8x0m_driver = {
        .id_table = snd_intel8x0m_ids,
        .probe = snd_intel8x0m_probe,
        .remove = __devexit_p(snd_intel8x0m_remove),
-#ifdef CONFIG_PM
-       .suspend = intel8x0m_suspend,
-       .resume = intel8x0m_resume,
-#endif
+       .driver = {
+               .pm = INTEL8X0M_PM_OPS,
+       },
 };
 
 module_pci_driver(intel8x0m_driver);
index deef213995869964791ddf53d03198019cfb1db0..36008a943aa353f6e3d68b76c8b7eaeef3af809f 100644 (file)
@@ -2459,9 +2459,10 @@ static int snd_m3_free(struct snd_m3 *chip)
  * APM support
  */
 #ifdef CONFIG_PM
-static int m3_suspend(struct pci_dev *pci, pm_message_t state)
+static int m3_suspend(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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;
 
@@ -2489,13 +2490,14 @@ static int m3_suspend(struct pci_dev *pci, pm_message_t state)
 
        pci_disable_device(pci);
        pci_save_state(pci);
-       pci_set_power_state(pci, pci_choose_state(pci, state));
+       pci_set_power_state(pci, PCI_D3hot);
        return 0;
 }
 
-static int m3_resume(struct pci_dev *pci)
+static int m3_resume(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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;
 
@@ -2546,6 +2548,11 @@ static int m3_resume(struct pci_dev *pci)
        chip->in_suspend = 0;
        return 0;
 }
+
+static SIMPLE_DEV_PM_OPS(m3_pm, m3_suspend, m3_resume);
+#define M3_PM_OPS      &m3_pm
+#else
+#define M3_PM_OPS      NULL
 #endif /* CONFIG_PM */
 
 #ifdef CONFIG_SND_MAESTRO3_INPUT
@@ -2842,10 +2849,9 @@ static struct pci_driver m3_driver = {
        .id_table = snd_m3_ids,
        .probe = snd_m3_probe,
        .remove = __devexit_p(snd_m3_remove),
-#ifdef CONFIG_PM
-       .suspend = m3_suspend,
-       .resume = m3_resume,
-#endif
+       .driver = {
+               .pm = M3_PM_OPS,
+       },
 };
        
 module_pci_driver(m3_driver);
index 8159b05ee94d4a10a41988597891c8765ba50c2f..465cff25b14622738f1e16d423fc6b579c32d0ad 100644 (file)
@@ -1382,9 +1382,10 @@ snd_nm256_peek_for_sig(struct nm256 *chip)
  * APM event handler, so the card is properly reinitialized after a power
  * event.
  */
-static int nm256_suspend(struct pci_dev *pci, pm_message_t state)
+static int nm256_suspend(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       struct pci_dev *pci = to_pci_dev(dev);
+       struct snd_card *card = dev_get_drvdata(dev);
        struct nm256 *chip = card->private_data;
 
        snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
@@ -1393,13 +1394,14 @@ static int nm256_suspend(struct pci_dev *pci, pm_message_t state)
        chip->coeffs_current = 0;
        pci_disable_device(pci);
        pci_save_state(pci);
-       pci_set_power_state(pci, pci_choose_state(pci, state));
+       pci_set_power_state(pci, PCI_D3hot);
        return 0;
 }
 
-static int nm256_resume(struct pci_dev *pci)
+static int nm256_resume(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       struct pci_dev *pci = to_pci_dev(dev);
+       struct snd_card *card = dev_get_drvdata(dev);
        struct nm256 *chip = card->private_data;
        int i;
 
@@ -1434,6 +1436,11 @@ static int nm256_resume(struct pci_dev *pci)
        chip->in_resume = 0;
        return 0;
 }
+
+static SIMPLE_DEV_PM_OPS(nm256_pm, nm256_suspend, nm256_resume);
+#define NM256_PM_OPS   &nm256_pm
+#else
+#define NM256_PM_OPS   NULL
 #endif /* CONFIG_PM */
 
 static int snd_nm256_free(struct nm256 *chip)
@@ -1747,10 +1754,9 @@ static struct pci_driver nm256_driver = {
        .id_table = snd_nm256_ids,
        .probe = snd_nm256_probe,
        .remove = __devexit_p(snd_nm256_remove),
-#ifdef CONFIG_PM
-       .suspend = nm256_suspend,
-       .resume = nm256_resume,
-#endif
+       .driver = {
+               .pm = NM256_PM_OPS,
+       },
 };
 
 module_pci_driver(nm256_driver);
index 610275bfbaeb2c2bae48f620f1232b7e12f027ed..37520a2b4dcf29c8f7cf7e869d74aed2ad74b36c 100644 (file)
@@ -873,8 +873,9 @@ static struct pci_driver oxygen_driver = {
        .probe = generic_oxygen_probe,
        .remove = __devexit_p(oxygen_pci_remove),
 #ifdef CONFIG_PM
-       .suspend = oxygen_pci_suspend,
-       .resume = oxygen_pci_resume,
+       .driver = {
+               .pm = &oxygen_pci_pm,
+       },
 #endif
 };
 
index f53897a708b449e97da2a2d3a835e18eed5afdc0..7112a89fb8bd0ba32319dc4fc458248605455d31 100644 (file)
@@ -162,8 +162,7 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id,
                    );
 void oxygen_pci_remove(struct pci_dev *pci);
 #ifdef CONFIG_PM
-int oxygen_pci_suspend(struct pci_dev *pci, pm_message_t state);
-int oxygen_pci_resume(struct pci_dev *pci);
+extern const struct dev_pm_ops oxygen_pci_pm;
 #endif
 void oxygen_pci_shutdown(struct pci_dev *pci);
 
index 92e2d67f16a1f8ad6e6f45925ad27e04e0796f2c..ab8738e21ad1378d569e349244d6e7bc6fac270c 100644 (file)
@@ -727,9 +727,10 @@ void oxygen_pci_remove(struct pci_dev *pci)
 EXPORT_SYMBOL(oxygen_pci_remove);
 
 #ifdef CONFIG_PM
-int oxygen_pci_suspend(struct pci_dev *pci, pm_message_t state)
+static int oxygen_pci_suspend(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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;
 
@@ -756,10 +757,9 @@ int oxygen_pci_suspend(struct pci_dev *pci, pm_message_t state)
 
        pci_disable_device(pci);
        pci_save_state(pci);
-       pci_set_power_state(pci, pci_choose_state(pci, state));
+       pci_set_power_state(pci, PCI_D3hot);
        return 0;
 }
-EXPORT_SYMBOL(oxygen_pci_suspend);
 
 static const u32 registers_to_restore[OXYGEN_IO_SIZE / 32] = {
        0xffffffff, 0x00ff077f, 0x00011d08, 0x007f00ff,
@@ -787,9 +787,10 @@ static void oxygen_restore_ac97(struct oxygen *chip, unsigned int codec)
                                          chip->saved_ac97_registers[codec][i]);
 }
 
-int oxygen_pci_resume(struct pci_dev *pci)
+static int oxygen_pci_resume(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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;
 
@@ -820,7 +821,9 @@ int oxygen_pci_resume(struct pci_dev *pci)
        snd_power_change_state(card, SNDRV_CTL_POWER_D0);
        return 0;
 }
-EXPORT_SYMBOL(oxygen_pci_resume);
+
+SIMPLE_DEV_PM_OPS(oxygen_pci_pm, oxygen_pci_suspend, oxygen_pci_resume);
+EXPORT_SYMBOL(oxygen_pci_pm);
 #endif /* CONFIG_PM */
 
 void oxygen_pci_shutdown(struct pci_dev *pci)
index 19962c6d38c3caf3850d5a71d4bb70307d301276..d3b606b69f3bf38864a16e6a1d77c5813d844d59 100644 (file)
@@ -94,8 +94,9 @@ static struct pci_driver xonar_driver = {
        .probe = xonar_probe,
        .remove = __devexit_p(oxygen_pci_remove),
 #ifdef CONFIG_PM
-       .suspend = oxygen_pci_suspend,
-       .resume = oxygen_pci_resume,
+       .driver = {
+               .pm = &oxygen_pci_pm,
+       },
 #endif
        .shutdown = oxygen_pci_shutdown,
 };
index cbeb3f77350c6e42ff8861c7304a3b5b4957920c..760ee467cd9aac9e8969d6c8cb2f03a94c6f1d3d 100644 (file)
@@ -1151,9 +1151,10 @@ static void riptide_handleirq(unsigned long dev_id)
 }
 
 #ifdef CONFIG_PM
-static int riptide_suspend(struct pci_dev *pci, pm_message_t state)
+static int riptide_suspend(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       struct pci_dev *pci = to_pci_dev(dev);
+       struct snd_card *card = dev_get_drvdata(dev);
        struct snd_riptide *chip = card->private_data;
 
        chip->in_suspend = 1;
@@ -1162,13 +1163,14 @@ static int riptide_suspend(struct pci_dev *pci, pm_message_t state)
        snd_ac97_suspend(chip->ac97);
        pci_disable_device(pci);
        pci_save_state(pci);
-       pci_set_power_state(pci, pci_choose_state(pci, state));
+       pci_set_power_state(pci, PCI_D3hot);
        return 0;
 }
 
-static int riptide_resume(struct pci_dev *pci)
+static int riptide_resume(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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);
@@ -1186,7 +1188,12 @@ static int riptide_resume(struct pci_dev *pci)
        chip->in_suspend = 0;
        return 0;
 }
-#endif
+
+static SIMPLE_DEV_PM_OPS(riptide_pm, riptide_suspend, riptide_resume);
+#define RIPTIDE_PM_OPS &riptide_pm
+#else
+#define RIPTIDE_PM_OPS NULL
+#endif /* CONFIG_PM */
 
 static int try_to_load_firmware(struct cmdif *cif, struct snd_riptide *chip)
 {
@@ -2180,10 +2187,9 @@ static struct pci_driver driver = {
        .id_table = snd_riptide_ids,
        .probe = snd_card_riptide_probe,
        .remove = __devexit_p(snd_card_riptide_remove),
-#ifdef CONFIG_PM
-       .suspend = riptide_suspend,
-       .resume = riptide_resume,
-#endif
+       .driver = {
+               .pm = RIPTIDE_PM_OPS,
+       },
 };
 
 #ifdef SUPPORT_JOYSTICK
index 1552642765d6eea4896da26bc715024764c49eaa..512434efcc31136f1570ab5e17429523a354f187 100644 (file)
@@ -1209,9 +1209,10 @@ static int sis_chip_init(struct sis7019 *sis)
 }
 
 #ifdef CONFIG_PM
-static int sis_suspend(struct pci_dev *pci, pm_message_t state)
+static int sis_suspend(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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;
        int i;
@@ -1241,13 +1242,14 @@ static int sis_suspend(struct pci_dev *pci, pm_message_t state)
 
        pci_disable_device(pci);
        pci_save_state(pci);
-       pci_set_power_state(pci, pci_choose_state(pci, state));
+       pci_set_power_state(pci, PCI_D3hot);
        return 0;
 }
 
-static int sis_resume(struct pci_dev *pci)
+static int sis_resume(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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;
        int i;
@@ -1298,6 +1300,11 @@ error:
        snd_card_disconnect(card);
        return -EIO;
 }
+
+static SIMPLE_DEV_PM_OPS(sis_pm, sis_suspend, sis_resume);
+#define SIS_PM_OPS     &sis_pm
+#else
+#define SIS_PM_OPS     NULL
 #endif /* CONFIG_PM */
 
 static int sis_alloc_suspend(struct sis7019 *sis)
@@ -1481,11 +1488,9 @@ static struct pci_driver sis7019_driver = {
        .id_table = snd_sis7019_ids,
        .probe = snd_sis7019_probe,
        .remove = __devexit_p(snd_sis7019_remove),
-
-#ifdef CONFIG_PM
-       .suspend = sis_suspend,
-       .resume = sis_resume,
-#endif
+       .driver = {
+               .pm = SIS_PM_OPS,
+       },
 };
 
 module_pci_driver(sis7019_driver);
index 611983ec73211f35e8ca761073a9c15803f65d96..f61346a555bbcec1e18d38db45df1362e7f51c33 100644 (file)
@@ -178,8 +178,9 @@ static struct pci_driver trident_driver = {
        .probe = snd_trident_probe,
        .remove = __devexit_p(snd_trident_remove),
 #ifdef CONFIG_PM
-       .suspend = snd_trident_suspend,
-       .resume = snd_trident_resume,
+       .driver = {
+               .pm = &snd_trident_pm,
+       },
 #endif
 };
 
index 61d3c0e8d4cead73f79547bf2b3d6f65286bf521..b4430c093bade185760e60b14f17ce09a4446c7e 100644 (file)
@@ -3920,9 +3920,10 @@ static void snd_trident_clear_voices(struct snd_trident * trident, unsigned shor
 }
 
 #ifdef CONFIG_PM
-int snd_trident_suspend(struct pci_dev *pci, pm_message_t state)
+static int snd_trident_suspend(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       struct pci_dev *pci = to_pci_dev(dev);
+       struct snd_card *card = dev_get_drvdata(dev);
        struct snd_trident *trident = card->private_data;
 
        trident->in_suspend = 1;
@@ -3936,13 +3937,14 @@ int snd_trident_suspend(struct pci_dev *pci, pm_message_t state)
 
        pci_disable_device(pci);
        pci_save_state(pci);
-       pci_set_power_state(pci, pci_choose_state(pci, state));
+       pci_set_power_state(pci, PCI_D3hot);
        return 0;
 }
 
-int snd_trident_resume(struct pci_dev *pci)
+static int snd_trident_resume(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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);
@@ -3979,4 +3981,6 @@ int snd_trident_resume(struct pci_dev *pci)
        trident->in_suspend = 0;
        return 0;
 }
+
+SIMPLE_DEV_PM_OPS(snd_trident_pm, snd_trident_suspend, snd_trident_resume);
 #endif /* CONFIG_PM */
index b5afab48943eeca6bcb8a6aac3836c83cafd7de8..0eb7245dd362de2445d383f343d904ac3f04edb1 100644 (file)
@@ -2242,9 +2242,10 @@ static int snd_via82xx_chip_init(struct via82xx *chip)
 /*
  * power management
  */
-static int snd_via82xx_suspend(struct pci_dev *pci, pm_message_t state)
+static int snd_via82xx_suspend(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       struct pci_dev *pci = to_pci_dev(dev);
+       struct snd_card *card = dev_get_drvdata(dev);
        struct via82xx *chip = card->private_data;
        int i;
 
@@ -2265,13 +2266,14 @@ static int snd_via82xx_suspend(struct pci_dev *pci, pm_message_t state)
 
        pci_disable_device(pci);
        pci_save_state(pci);
-       pci_set_power_state(pci, pci_choose_state(pci, state));
+       pci_set_power_state(pci, PCI_D3hot);
        return 0;
 }
 
-static int snd_via82xx_resume(struct pci_dev *pci)
+static int snd_via82xx_resume(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       struct pci_dev *pci = to_pci_dev(dev);
+       struct snd_card *card = dev_get_drvdata(dev);
        struct via82xx *chip = card->private_data;
        int i;
 
@@ -2306,6 +2308,11 @@ static int snd_via82xx_resume(struct pci_dev *pci)
        snd_power_change_state(card, SNDRV_CTL_POWER_D0);
        return 0;
 }
+
+static SIMPLE_DEV_PM_OPS(snd_via82xx_pm, snd_via82xx_suspend, snd_via82xx_resume);
+#define SND_VIA82XX_PM_OPS     &snd_via82xx_pm
+#else
+#define SND_VIA82XX_PM_OPS     NULL
 #endif /* CONFIG_PM */
 
 static int snd_via82xx_free(struct via82xx *chip)
@@ -2624,10 +2631,9 @@ static struct pci_driver via82xx_driver = {
        .id_table = snd_via82xx_ids,
        .probe = snd_via82xx_probe,
        .remove = __devexit_p(snd_via82xx_remove),
-#ifdef CONFIG_PM
-       .suspend = snd_via82xx_suspend,
-       .resume = snd_via82xx_resume,
-#endif
+       .driver = {
+               .pm = SND_VIA82XX_PM_OPS,
+       },
 };
 
 module_pci_driver(via82xx_driver);
index 59fd47ed0a31238e2aeb37e412cdfba591feafc5..e886bc16999db91d6882d82cdc0b96580a36d9c3 100644 (file)
@@ -1023,9 +1023,10 @@ static int snd_via82xx_chip_init(struct via82xx_modem *chip)
 /*
  * power management
  */
-static int snd_via82xx_suspend(struct pci_dev *pci, pm_message_t state)
+static int snd_via82xx_suspend(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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;
 
@@ -1039,13 +1040,14 @@ static int snd_via82xx_suspend(struct pci_dev *pci, pm_message_t state)
 
        pci_disable_device(pci);
        pci_save_state(pci);
-       pci_set_power_state(pci, pci_choose_state(pci, state));
+       pci_set_power_state(pci, PCI_D3hot);
        return 0;
 }
 
-static int snd_via82xx_resume(struct pci_dev *pci)
+static int snd_via82xx_resume(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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;
 
@@ -1069,6 +1071,11 @@ static int snd_via82xx_resume(struct pci_dev *pci)
        snd_power_change_state(card, SNDRV_CTL_POWER_D0);
        return 0;
 }
+
+static SIMPLE_DEV_PM_OPS(snd_via82xx_pm, snd_via82xx_suspend, snd_via82xx_resume);
+#define SND_VIA82XX_PM_OPS     &snd_via82xx_pm
+#else
+#define SND_VIA82XX_PM_OPS     NULL
 #endif /* CONFIG_PM */
 
 static int snd_via82xx_free(struct via82xx_modem *chip)
@@ -1228,10 +1235,9 @@ static struct pci_driver via82xx_modem_driver = {
        .id_table = snd_via82xx_modem_ids,
        .probe = snd_via82xx_probe,
        .remove = __devexit_p(snd_via82xx_remove),
-#ifdef CONFIG_PM
-       .suspend = snd_via82xx_suspend,
-       .resume = snd_via82xx_resume,
-#endif
+       .driver = {
+               .pm = SND_VIA82XX_PM_OPS,
+       },
 };
 
 module_pci_driver(via82xx_modem_driver);
index 1ea1f656a5dc2e300fa48a757052e450dac6485d..b89e7a86e9d8f809bdee1306b7fb92ac0d2bcffd 100644 (file)
@@ -258,22 +258,24 @@ static void __devexit snd_vx222_remove(struct pci_dev *pci)
 }
 
 #ifdef CONFIG_PM
-static int snd_vx222_suspend(struct pci_dev *pci, pm_message_t state)
+static int snd_vx222_suspend(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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, state);
+       err = snd_vx_suspend(&vx->core);
        pci_disable_device(pci);
        pci_save_state(pci);
-       pci_set_power_state(pci, pci_choose_state(pci, state));
+       pci_set_power_state(pci, PCI_D3hot);
        return err;
 }
 
-static int snd_vx222_resume(struct pci_dev *pci)
+static int snd_vx222_resume(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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);
@@ -287,6 +289,11 @@ static int snd_vx222_resume(struct pci_dev *pci)
        pci_set_master(pci);
        return snd_vx_resume(&vx->core);
 }
+
+static SIMPLE_DEV_PM_OPS(snd_vx222_pm, snd_vx222_suspend, snd_vx222_resume);
+#define SND_VX222_PM_OPS       &snd_vx222_pm
+#else
+#define SND_VX222_PM_OPS       NULL
 #endif
 
 static struct pci_driver vx222_driver = {
@@ -294,10 +301,9 @@ static struct pci_driver vx222_driver = {
        .id_table = snd_vx222_ids,
        .probe = snd_vx222_probe,
        .remove = __devexit_p(snd_vx222_remove),
-#ifdef CONFIG_PM
-       .suspend = snd_vx222_suspend,
-       .resume = snd_vx222_resume,
-#endif
+       .driver = {
+               .pm = SND_VX222_PM_OPS,
+       },
 };
 
 module_pci_driver(vx222_driver);
index 9a1d01d653a7cff03b68fc64b572fb9e32376516..7e20ddb9123a2f395e40fb6d164c0dcd37ae81a0 100644 (file)
@@ -356,8 +356,9 @@ static struct pci_driver ymfpci_driver = {
        .probe = snd_card_ymfpci_probe,
        .remove = __devexit_p(snd_card_ymfpci_remove),
 #ifdef CONFIG_PM
-       .suspend = snd_ymfpci_suspend,
-       .resume = snd_ymfpci_resume,
+       .driver = {
+               .pm = &snd_ymfpci_pm,
+       },
 #endif
 };
 
index a8159b81e9c438ea42b63bb79e9bdcd65e521d8d..c706901d6ff63b079ce7edbcedb4931190405b64 100644 (file)
@@ -2302,9 +2302,10 @@ static int saved_regs_index[] = {
 };
 #define YDSXGR_NUM_SAVED_REGS  ARRAY_SIZE(saved_regs_index)
 
-int snd_ymfpci_suspend(struct pci_dev *pci, pm_message_t state)
+static int snd_ymfpci_suspend(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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;
        
@@ -2326,13 +2327,14 @@ int snd_ymfpci_suspend(struct pci_dev *pci, pm_message_t state)
        snd_ymfpci_disable_dsp(chip);
        pci_disable_device(pci);
        pci_save_state(pci);
-       pci_set_power_state(pci, pci_choose_state(pci, state));
+       pci_set_power_state(pci, PCI_D3hot);
        return 0;
 }
 
-int snd_ymfpci_resume(struct pci_dev *pci)
+static int snd_ymfpci_resume(struct device *dev)
 {
-       struct snd_card *card = pci_get_drvdata(pci);
+       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;
 
@@ -2370,6 +2372,8 @@ int snd_ymfpci_resume(struct pci_dev *pci)
        snd_power_change_state(card, SNDRV_CTL_POWER_D0);
        return 0;
 }
+
+SIMPLE_DEV_PM_OPS(snd_ymfpci_pm, snd_ymfpci_suspend, snd_ymfpci_resume);
 #endif /* CONFIG_PM */
 
 int __devinit snd_ymfpci_create(struct snd_card *card,
index 512f0b4723756a57012f1551894886e45d0b7d43..8f9350475c7bdb6392e510c9024980d66ba4e61b 100644 (file)
@@ -260,7 +260,7 @@ static int vxp_suspend(struct pcmcia_device *link)
        snd_printdd(KERN_DEBUG "SUSPEND\n");
        if (chip) {
                snd_printdd(KERN_DEBUG "snd_vx_suspend calling\n");
-               snd_vx_suspend(chip, PMSG_SUSPEND);
+               snd_vx_suspend(chip);
        }
 
        return 0;