]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
virtio: rng: split out common code in probe / remove for s3/s4 ops
authorAmit Shah <amit.shah@redhat.com>
Mon, 28 May 2012 06:48:42 +0000 (12:18 +0530)
committerStephen Rothwell <sfr@canb.auug.org.au>
Sat, 21 Jul 2012 22:28:13 +0000 (08:28 +1000)
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>
drivers/char/hw_random/virtio-rng.c

index 2dc9ce183cc6fdadb4332581864550c8c5ad8745..a9673a757009c558ce74c6b18cd4b23065259f69 100644 (file)
@@ -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;
 
@@ -106,7 +106,7 @@ 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;
@@ -114,6 +114,16 @@ static void __devexit virtrng_remove(struct virtio_device *vdev)
        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 },