提交 d0775363 编写于 作者: A Amit Shah 提交者: Rusty Russell

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: NAmit Shah <amit.shah@redhat.com>
Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
上级 4678d6f9
...@@ -716,19 +716,28 @@ static void __devexit virtio_pci_remove(struct pci_dev *pci_dev) ...@@ -716,19 +716,28 @@ static void __devexit virtio_pci_remove(struct pci_dev *pci_dev)
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int virtio_pci_suspend(struct pci_dev *pci_dev, pm_message_t state) static int virtio_pci_suspend(struct device *dev)
{ {
struct pci_dev *pci_dev = to_pci_dev(dev);
pci_save_state(pci_dev); pci_save_state(pci_dev);
pci_set_power_state(pci_dev, PCI_D3hot); pci_set_power_state(pci_dev, PCI_D3hot);
return 0; return 0;
} }
static int virtio_pci_resume(struct pci_dev *pci_dev) static int virtio_pci_resume(struct device *dev)
{ {
struct pci_dev *pci_dev = to_pci_dev(dev);
pci_restore_state(pci_dev); pci_restore_state(pci_dev);
pci_set_power_state(pci_dev, PCI_D0); pci_set_power_state(pci_dev, PCI_D0);
return 0; return 0;
} }
static const struct dev_pm_ops virtio_pci_pm_ops = {
.suspend = virtio_pci_suspend,
.resume = virtio_pci_resume,
};
#endif #endif
static struct pci_driver virtio_pci_driver = { static struct pci_driver virtio_pci_driver = {
...@@ -737,8 +746,7 @@ static struct pci_driver virtio_pci_driver = { ...@@ -737,8 +746,7 @@ static struct pci_driver virtio_pci_driver = {
.probe = virtio_pci_probe, .probe = virtio_pci_probe,
.remove = __devexit_p(virtio_pci_remove), .remove = __devexit_p(virtio_pci_remove),
#ifdef CONFIG_PM #ifdef CONFIG_PM
.suspend = virtio_pci_suspend, .driver.pm = &virtio_pci_pm_ops,
.resume = virtio_pci_resume,
#endif #endif
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册