24 #include <linux/virtio.h>
26 #include <linux/module.h>
29 static unsigned int data_avail;
33 static void random_recv_done(
struct virtqueue *vq)
43 static void register_buffer(
u8 *
buf,
size_t size)
56 static int virtio_read(
struct hwrng *rng,
void *buf,
size_t size,
bool wait)
62 init_completion(&have_data);
63 register_buffer(buf, size);
78 static void virtio_cleanup(
struct hwrng *rng)
85 static struct hwrng virtio_hwrng = {
87 .cleanup = virtio_cleanup,
96 vq = virtio_find_single_vq(vdev, random_recv_done,
"input");
102 vdev->
config->del_vqs(vdev);
111 vdev->
config->reset(vdev);
114 vdev->
config->del_vqs(vdev);
119 return probe_common(vdev);
136 return probe_common(vdev);
146 .driver.name = KBUILD_MODNAME,
149 .probe = virtrng_probe,
152 .freeze = virtrng_freeze,
153 .restore = virtrng_restore,
162 static void __exit fini(
void)