diff options
author | Amit Shah <amit.shah@redhat.com> | 2012-05-28 12:18:43 +0530 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2012-07-30 13:30:50 +0930 |
commit | 0bc1a2ef19b45bb23617b203bc631b44609f17ba (patch) | |
tree | 6e14cc4b5fb1b50d1acb815ddc3b9ebbe89cfd00 /drivers/char | |
parent | 178d855e7810deecb7fa96afdf82ec45b0284233 (diff) | |
download | linux-0bc1a2ef19b45bb23617b203bc631b44609f17ba.tar.gz linux-0bc1a2ef19b45bb23617b203bc631b44609f17ba.tar.bz2 linux-0bc1a2ef19b45bb23617b203bc631b44609f17ba.zip |
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: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/hw_random/virtio-rng.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c index a9673a757009..5708299507d0 100644 --- a/drivers/char/hw_random/virtio-rng.c +++ b/drivers/char/hw_random/virtio-rng.c @@ -124,6 +124,19 @@ static void __devexit virtrng_remove(struct virtio_device *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[] = { { VIRTIO_ID_RNG, VIRTIO_DEV_ANY_ID }, { 0 }, @@ -135,6 +148,10 @@ static struct virtio_driver virtio_rng_driver = { .id_table = id_table, .probe = virtrng_probe, .remove = __devexit_p(virtrng_remove), +#ifdef CONFIG_PM + .freeze = virtrng_freeze, + .restore = virtrng_restore, +#endif }; static int __init init(void) |