Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 178d855e authored by Amit Shah's avatar Amit Shah Committed by Rusty Russell
Browse files

virtio: rng: split out common code in probe / remove for s3/s4 ops



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: default avatarAmit Shah <amit.shah@redhat.com>
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent 4476987a
Loading
Loading
Loading
Loading
+12 −2
Original line number Original line Diff line number Diff line
@@ -88,7 +88,7 @@ static struct hwrng virtio_hwrng = {
	.read		= virtio_read,
	.read		= virtio_read,
};
};


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


@@ -106,7 +106,7 @@ static int virtrng_probe(struct virtio_device *vdev)
	return 0;
	return 0;
}
}


static void __devexit virtrng_remove(struct virtio_device *vdev)
static void remove_common(struct virtio_device *vdev)
{
{
	vdev->config->reset(vdev);
	vdev->config->reset(vdev);
	busy = false;
	busy = false;
@@ -114,6 +114,16 @@ static void __devexit virtrng_remove(struct virtio_device *vdev)
	vdev->config->del_vqs(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[] = {
static struct virtio_device_id id_table[] = {
	{ VIRTIO_ID_RNG, VIRTIO_DEV_ANY_ID },
	{ VIRTIO_ID_RNG, VIRTIO_DEV_ANY_ID },
	{ 0 },
	{ 0 },