hwrng: place mutex around read functions and buffers.
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 8 Dec 2014 08:50:35 +0000 (16:50 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Mon, 22 Dec 2014 12:02:38 +0000 (23:02 +1100)
commit9372b35e11149c5314f56f939775e67d83057604
tree5f5d8e33af4f3f02a56299c88348853b2582bca7
parent25fb8638e919bc7431a73f2fb4a9713818ae2c9d
hwrng: place mutex around read functions and buffers.

There's currently a big lock around everything, and it means that we
can't query sysfs (eg /sys/devices/virtual/misc/hw_random/rng_current)
while the rng is reading.  This is a real problem when the rng is slow,
or blocked (eg. virtio_rng with qemu's default /dev/random backend)

This doesn't help (it leaves the current lock untouched), just adds a
lock to protect the read function and the static buffers, in preparation
for transition.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/char/hw_random/core.c