diff options
author | Amit Shah <amit.shah@redhat.com> | 2011-12-22 06:28:25 -0500 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2012-01-12 00:14:44 -0500 |
commit | d077536386595309060dda57e7b7474c501a589b (patch) | |
tree | f1da57ea2c6c11057985d317738787661336cf25 /drivers | |
parent | 4678d6f970c2f7c0cbfefc0cc666432d153b321b (diff) |
virtio: pci: switch to new PM API
The older PM API doesn't have a way to get notifications on hibernate
events. Switch to the newer one that gives us those notifications.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/virtio/virtio_pci.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c index 688b42d28dad..7f9ac1af7cfd 100644 --- a/drivers/virtio/virtio_pci.c +++ b/drivers/virtio/virtio_pci.c | |||
@@ -716,19 +716,28 @@ static void __devexit virtio_pci_remove(struct pci_dev *pci_dev) | |||
716 | } | 716 | } |
717 | 717 | ||
718 | #ifdef CONFIG_PM | 718 | #ifdef CONFIG_PM |
719 | static int virtio_pci_suspend(struct pci_dev *pci_dev, pm_message_t state) | 719 | static int virtio_pci_suspend(struct device *dev) |
720 | { | 720 | { |
721 | struct pci_dev *pci_dev = to_pci_dev(dev); | ||
722 | |||
721 | pci_save_state(pci_dev); | 723 | pci_save_state(pci_dev); |
722 | pci_set_power_state(pci_dev, PCI_D3hot); | 724 | pci_set_power_state(pci_dev, PCI_D3hot); |
723 | return 0; | 725 | return 0; |
724 | } | 726 | } |
725 | 727 | ||
726 | static int virtio_pci_resume(struct pci_dev *pci_dev) | 728 | static int virtio_pci_resume(struct device *dev) |
727 | { | 729 | { |
730 | struct pci_dev *pci_dev = to_pci_dev(dev); | ||
731 | |||
728 | pci_restore_state(pci_dev); | 732 | pci_restore_state(pci_dev); |
729 | pci_set_power_state(pci_dev, PCI_D0); | 733 | pci_set_power_state(pci_dev, PCI_D0); |
730 | return 0; | 734 | return 0; |
731 | } | 735 | } |
736 | |||
737 | static const struct dev_pm_ops virtio_pci_pm_ops = { | ||
738 | .suspend = virtio_pci_suspend, | ||
739 | .resume = virtio_pci_resume, | ||
740 | }; | ||
732 | #endif | 741 | #endif |
733 | 742 | ||
734 | static struct pci_driver virtio_pci_driver = { | 743 | static struct pci_driver virtio_pci_driver = { |
@@ -737,8 +746,7 @@ static struct pci_driver virtio_pci_driver = { | |||
737 | .probe = virtio_pci_probe, | 746 | .probe = virtio_pci_probe, |
738 | .remove = __devexit_p(virtio_pci_remove), | 747 | .remove = __devexit_p(virtio_pci_remove), |
739 | #ifdef CONFIG_PM | 748 | #ifdef CONFIG_PM |
740 | .suspend = virtio_pci_suspend, | 749 | .driver.pm = &virtio_pci_pm_ops, |
741 | .resume = virtio_pci_resume, | ||
742 | #endif | 750 | #endif |
743 | }; | 751 | }; |
744 | 752 | ||