Commit 0bc1a2ef authored by Amit Shah's avatar Amit Shah Committed by Rusty Russell

virtio: rng: s3/s4 support

Unregister from the hwrng interface and remove the vq before entering
the S3 or S4 states.  Add the vq and re-register with hwrng on restore.
Signed-off-by: default avatarAmit Shah <amit.shah@redhat.com>
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent 178d855e
...@@ -124,6 +124,19 @@ static void __devexit virtrng_remove(struct virtio_device *vdev) ...@@ -124,6 +124,19 @@ static void __devexit virtrng_remove(struct virtio_device *vdev)
remove_common(vdev); remove_common(vdev);
} }
#ifdef CONFIG_PM
static int virtrng_freeze(struct virtio_device *vdev)
{
remove_common(vdev);
return 0;
}
static int virtrng_restore(struct virtio_device *vdev)
{
return probe_common(vdev);
}
#endif
static struct virtio_device_id id_table[] = { static struct virtio_device_id id_table[] = {
{ VIRTIO_ID_RNG, VIRTIO_DEV_ANY_ID }, { VIRTIO_ID_RNG, VIRTIO_DEV_ANY_ID },
{ 0 }, { 0 },
...@@ -135,6 +148,10 @@ static struct virtio_driver virtio_rng_driver = { ...@@ -135,6 +148,10 @@ static struct virtio_driver virtio_rng_driver = {
.id_table = id_table, .id_table = id_table,
.probe = virtrng_probe, .probe = virtrng_probe,
.remove = __devexit_p(virtrng_remove), .remove = __devexit_p(virtrng_remove),
#ifdef CONFIG_PM
.freeze = virtrng_freeze,
.restore = virtrng_restore,
#endif
}; };
static int __init init(void) static int __init init(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment