aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/virtio/virtio_pci.c
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2012-03-29 03:24:43 -0400
committerAmit Shah <amit.shah@redhat.com>2012-03-30 22:39:51 -0400
commit0517fdd156c46c23501451158c6b0ff9fb7236d1 (patch)
tree8699ac4ba7b4d6dbe01e187293db6c53d0eddb33 /drivers/virtio/virtio_pci.c
parentf38f8387cbdc4138a492ce9f2a5f04fd3cd3cf33 (diff)
virtio-pci: drop restore_common()
restore_common() was shared between restore and thaw callbacks. With thaw gone, we don't need restore_common() anymore. Signed-off-by: Amit Shah <amit.shah@redhat.com>
Diffstat (limited to 'drivers/virtio/virtio_pci.c')
-rw-r--r--drivers/virtio/virtio_pci.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c
index a35a402dfd78..982d6c9a2bf0 100644
--- a/drivers/virtio/virtio_pci.c
+++ b/drivers/virtio/virtio_pci.c
@@ -758,33 +758,24 @@ static int virtio_pci_freeze(struct device *dev)
758 return ret; 758 return ret;
759} 759}
760 760
761static int restore_common(struct device *dev) 761static int virtio_pci_restore(struct device *dev)
762{ 762{
763 struct pci_dev *pci_dev = to_pci_dev(dev); 763 struct pci_dev *pci_dev = to_pci_dev(dev);
764 struct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev); 764 struct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev);
765 struct virtio_driver *drv;
765 int ret; 766 int ret;
766 767
768 drv = container_of(vp_dev->vdev.dev.driver,
769 struct virtio_driver, driver);
770
767 ret = pci_enable_device(pci_dev); 771 ret = pci_enable_device(pci_dev);
768 if (ret) 772 if (ret)
769 return ret; 773 return ret;
774
770 pci_set_master(pci_dev); 775 pci_set_master(pci_dev);
771 vp_finalize_features(&vp_dev->vdev); 776 vp_finalize_features(&vp_dev->vdev);
772 777
773 return ret; 778 if (drv && drv->restore)
774}
775
776static int virtio_pci_restore(struct device *dev)
777{
778 struct pci_dev *pci_dev = to_pci_dev(dev);
779 struct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev);
780 struct virtio_driver *drv;
781 int ret;
782
783 drv = container_of(vp_dev->vdev.dev.driver,
784 struct virtio_driver, driver);
785
786 ret = restore_common(dev);
787 if (!ret && drv && drv->restore)
788 ret = drv->restore(&vp_dev->vdev); 779 ret = drv->restore(&vp_dev->vdev);
789 780
790 /* Finally, tell the device we're all set */ 781 /* Finally, tell the device we're all set */