[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <e69775286e34e88ff5c7ad50ede4fafdd5f16087.1317309123.git.amit.shah@redhat.com>
Date: Thu, 29 Sep 2011 20:56:07 +0530
From: Amit Shah <amit.shah@...hat.com>
To: Rusty Russell <rusty@...tcorp.com.au>
Cc: linux-kernel@...r.kernel.org,
"Michael S. Tsirkin" <mst@...hat.com>,
Amit Shah <amit.shah@...hat.com>
Subject: [PATCH 11/11] virtio: balloon: Add freeze, restore handlers to support S4
Delete the vqs on the freeze callback to prepare for hibernation.
Re-create the vqs in the restore callback to resume normal function.
Signed-off-by: Amit Shah <amit.shah@...hat.com>
---
drivers/virtio/virtio_balloon.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index 571d443..3ff955f9 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -362,6 +362,19 @@ static void __devexit virtballoon_remove(struct virtio_device *vdev)
kfree(vb);
}
+#ifdef CONFIG_PM
+static int virtballoon_freeze(struct virtio_device *vdev)
+{
+ vdev->config->del_vqs(vdev);
+ return 0;
+}
+
+static int virtballoon_restore(struct virtio_device *vdev)
+{
+ return init_vqs(vdev->priv);
+}
+#endif
+
static unsigned int features[] = {
VIRTIO_BALLOON_F_MUST_TELL_HOST,
VIRTIO_BALLOON_F_STATS_VQ,
@@ -376,6 +389,10 @@ static struct virtio_driver virtio_balloon_driver = {
.probe = virtballoon_probe,
.remove = __devexit_p(virtballoon_remove),
.config_changed = virtballoon_changed,
+#ifdef CONFIG_PM
+ .freeze = virtballoon_freeze,
+ .restore = virtballoon_restore,
+#endif
};
static int __init init(void)
--
1.7.6.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists