diff options
| author | Amit Shah <amit.shah@redhat.com> | 2012-05-28 02:48:43 -0400 |
|---|---|---|
| committer | Rusty Russell <rusty@rustcorp.com.au> | 2012-07-30 00:00:50 -0400 |
| commit | 0bc1a2ef19b45bb23617b203bc631b44609f17ba (patch) | |
| tree | 6e14cc4b5fb1b50d1acb815ddc3b9ebbe89cfd00 | |
| parent | 178d855e7810deecb7fa96afdf82ec45b0284233 (diff) | |
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>
| -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) | |||
| 124 | remove_common(vdev); | 124 | remove_common(vdev); |
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | #ifdef CONFIG_PM | ||
| 128 | static int virtrng_freeze(struct virtio_device *vdev) | ||
| 129 | { | ||
| 130 | remove_common(vdev); | ||
| 131 | return 0; | ||
| 132 | } | ||
| 133 | |||
| 134 | static int virtrng_restore(struct virtio_device *vdev) | ||
| 135 | { | ||
| 136 | return probe_common(vdev); | ||
| 137 | } | ||
| 138 | #endif | ||
| 139 | |||
| 127 | static struct virtio_device_id id_table[] = { | 140 | static struct virtio_device_id id_table[] = { |
| 128 | { VIRTIO_ID_RNG, VIRTIO_DEV_ANY_ID }, | 141 | { VIRTIO_ID_RNG, VIRTIO_DEV_ANY_ID }, |
| 129 | { 0 }, | 142 | { 0 }, |
| @@ -135,6 +148,10 @@ static struct virtio_driver virtio_rng_driver = { | |||
| 135 | .id_table = id_table, | 148 | .id_table = id_table, |
| 136 | .probe = virtrng_probe, | 149 | .probe = virtrng_probe, |
| 137 | .remove = __devexit_p(virtrng_remove), | 150 | .remove = __devexit_p(virtrng_remove), |
| 151 | #ifdef CONFIG_PM | ||
| 152 | .freeze = virtrng_freeze, | ||
| 153 | .restore = virtrng_restore, | ||
| 154 | #endif | ||
| 138 | }; | 155 | }; |
| 139 | 156 | ||
| 140 | static int __init init(void) | 157 | static int __init init(void) |
