mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 05:48:40 +00:00
hwrng: virtio - Virtio RNG devices need to be re-registered after suspend/resume
The patch for
commit: 5c06273401
Author: Amit Shah <amit.shah@redhat.com>
Date: Sun Jul 27 07:34:01 2014 +0930
virtio: rng: delay hwrng_register() till driver is ready
moved the call to hwrng_register() out of the probe routine into the scan
routine. We need to call hwrng_register() after a suspend/restore cycle
to re-register the device, but the scan function is not invoked for the
restore. Add the call to hwrng_register() to virtio_restore().
Reviewed-by: Liam Merwick <Liam.Merwick@oracle.com>
Signed-off-by: Jim Quigley <Jim.Quigley@oracle.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
747f6ec6e8
commit
e5cc6e79bb
1 changed files with 20 additions and 1 deletions
|
@ -184,7 +184,26 @@ static int virtrng_freeze(struct virtio_device *vdev)
|
|||
|
||||
static int virtrng_restore(struct virtio_device *vdev)
|
||||
{
|
||||
return probe_common(vdev);
|
||||
int err;
|
||||
|
||||
err = probe_common(vdev);
|
||||
if (!err) {
|
||||
struct virtrng_info *vi = vdev->priv;
|
||||
|
||||
/*
|
||||
* Set hwrng_removed to ensure that virtio_read()
|
||||
* does not block waiting for data before the
|
||||
* registration is complete.
|
||||
*/
|
||||
vi->hwrng_removed = true;
|
||||
err = hwrng_register(&vi->hwrng);
|
||||
if (!err) {
|
||||
vi->hwrng_register_done = true;
|
||||
vi->hwrng_removed = false;
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue