From 68cb2b559278858ef9f3a7722f95df88797c7840 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 2 Jul 2012 15:20:37 +0200 Subject: ALSA: Convert to new pm_ops for PCI drivers 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 --- sound/pci/maestro3.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'sound/pci/maestro3.c') diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c index deef2139958..36008a943aa 100644 --- a/sound/pci/maestro3.c +++ b/sound/pci/maestro3.c @@ -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); -- cgit v1.2.3-70-g09d2