Skip to content

Commit

Permalink
virtio: rng: split out common code in probe / remove for s3/s4 ops
Browse files Browse the repository at this point in the history
The freeze/restore s3/s4 operations will use code that's common to the
probe and remove routines.  Put the common code in separate funcitons.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
Amit Shah authored and Rusty Russell committed Jul 30, 2012
1 parent 4476987 commit 178d855
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions drivers/char/hw_random/virtio-rng.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ static struct hwrng virtio_hwrng = {
.read = virtio_read,
};

static int virtrng_probe(struct virtio_device *vdev)
static int probe_common(struct virtio_device *vdev)
{
int err;

Expand All @@ -106,14 +106,24 @@ static int virtrng_probe(struct virtio_device *vdev)
return 0;
}

static void __devexit virtrng_remove(struct virtio_device *vdev)
static void remove_common(struct virtio_device *vdev)
{
vdev->config->reset(vdev);
busy = false;
hwrng_unregister(&virtio_hwrng);
vdev->config->del_vqs(vdev);
}

static int virtrng_probe(struct virtio_device *vdev)
{
return probe_common(vdev);
}

static void __devexit virtrng_remove(struct virtio_device *vdev)
{
remove_common(vdev);
}

static struct virtio_device_id id_table[] = {
{ VIRTIO_ID_RNG, VIRTIO_DEV_ANY_ID },
{ 0 },
Expand Down

0 comments on commit 178d855

Please sign in to comment.